Commit 78f45c78 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent dc6474fb
...@@ -26,6 +26,7 @@ import ( ...@@ -26,6 +26,7 @@ import (
"sync" "sync"
"fmt" "fmt"
"lab.nexedi.com/kirr/go123/xruntime/debug"
) )
// NodeLink is a node-node link in NEO // NodeLink is a node-node link in NEO
...@@ -49,7 +50,8 @@ import ( ...@@ -49,7 +50,8 @@ import (
type NodeLink struct { type NodeLink struct {
peerLink net.Conn // raw conn to peer peerLink net.Conn // raw conn to peer
connMu sync.Mutex // TODO -> RW ? //connMu sync.Mutex // TODO -> RW ?
connMu debug.Mutex // TODO -> RW ?
connTab map[uint32]*Conn // connId -> Conn associated with connId connTab map[uint32]*Conn // connId -> Conn associated with connId
nextConnId uint32 // next connId to use for Conn initiated by us nextConnId uint32 // next connId to use for Conn initiated by us
...@@ -305,20 +307,21 @@ func (nl *NodeLink) serveRecv() { ...@@ -305,20 +307,21 @@ func (nl *NodeLink) serveRecv() {
if err != nil { if err != nil {
// on IO error framing over peerLink becomes broken // on IO error framing over peerLink becomes broken
// so we are marking node link and all connections as closed // so we are marking node link and all connections as closed
println("\tzzz")
nl.connMu.Lock()
println("\tzzz 2")
defer nl.connMu.Unlock()
println("\tqqq")
select { select {
case <-nl.closed: case <-nl.closed:
// error due to closing NodeLink // error due to closing NodeLink
nl.recvErr = ErrLinkClosed err = ErrLinkClosed
default: default:
nl.recvErr = err
} }
println("\tzzz")
nl.connMu.Lock()
println("\tzzz 2")
defer nl.connMu.Unlock()
nl.recvErr = err
println("\trrr") println("\trrr")
// wake-up all conns & mark node link as closed // wake-up all conns & mark node link as closed
nl.close() nl.close()
...@@ -403,9 +406,10 @@ func (nl *NodeLink) serveSend() { ...@@ -403,9 +406,10 @@ func (nl *NodeLink) serveSend() {
// wake-up all conns & mark node link as closed // wake-up all conns & mark node link as closed
nl.close() nl.close()
} }
return
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment