Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
78f45c78
Commit
78f45c78
authored
Apr 27, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dc6474fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
go/neo/connection.go
go/neo/connection.go
+13
-9
No files found.
go/neo/connection.go
View file @
78f45c78
...
@@ -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
(
"
\t
zzz"
)
nl
.
connMu
.
Lock
()
println
(
"
\t
zzz 2"
)
defer
nl
.
connMu
.
Unlock
()
println
(
"
\t
qqq"
)
select
{
select
{
case
<-
nl
.
closed
:
case
<-
nl
.
closed
:
// error due to closing NodeLink
// error due to closing NodeLink
nl
.
recvE
rr
=
ErrLinkClosed
e
rr
=
ErrLinkClosed
default
:
default
:
nl
.
recvErr
=
err
}
}
println
(
"
\t
zzz"
)
nl
.
connMu
.
Lock
()
println
(
"
\t
zzz 2"
)
defer
nl
.
connMu
.
Unlock
()
nl
.
recvErr
=
err
println
(
"
\t
rrr"
)
println
(
"
\t
rrr"
)
// 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
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment