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
481da375
Commit
481da375
authored
Apr 28, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3b5bb769
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
go/neo/connection.go
go/neo/connection.go
+5
-4
No files found.
go/neo/connection.go
View file @
481da375
...
@@ -214,7 +214,8 @@ func (nl *NodeLink) shutdown() {
...
@@ -214,7 +214,8 @@ func (nl *NodeLink) shutdown() {
}
}
// Close closes node-node link.
// Close closes node-node link.
// IO on connections established over it is automatically interrupted with an error.
// All blocking operations - Accept and IO on associated connections
// established over node link - are automatically interrupted with an error.
func
(
nl
*
NodeLink
)
Close
()
error
{
func
(
nl
*
NodeLink
)
Close
()
error
{
atomic
.
StoreUint32
(
&
nl
.
closed
,
1
)
atomic
.
StoreUint32
(
&
nl
.
closed
,
1
)
nl
.
shutdown
()
nl
.
shutdown
()
...
@@ -236,6 +237,7 @@ func (c *Conn) shutdown() {
...
@@ -236,6 +237,7 @@ func (c *Conn) shutdown() {
// background on the wire not to break node-node link framing.
// background on the wire not to break node-node link framing.
func
(
c
*
Conn
)
Close
()
error
{
func
(
c
*
Conn
)
Close
()
error
{
// adjust nodeLink.connTab
// adjust nodeLink.connTab
// (if nodelink was already shutted down and connTab=nil - delete will be noop)
c
.
nodeLink
.
connMu
.
Lock
()
c
.
nodeLink
.
connMu
.
Lock
()
delete
(
c
.
nodeLink
.
connTab
,
c
.
connId
)
delete
(
c
.
nodeLink
.
connTab
,
c
.
connId
)
c
.
nodeLink
.
connMu
.
Unlock
()
c
.
nodeLink
.
connMu
.
Unlock
()
...
@@ -326,6 +328,7 @@ func (nl *NodeLink) serveRecv() {
...
@@ -326,6 +328,7 @@ func (nl *NodeLink) serveRecv() {
connId
:=
ntoh32
(
pkt
.
Header
()
.
ConnId
)
connId
:=
ntoh32
(
pkt
.
Header
()
.
ConnId
)
nl
.
connMu
.
Lock
()
nl
.
connMu
.
Lock
()
// XXX connTab == nil here
conn
:=
nl
.
connTab
[
connId
]
conn
:=
nl
.
connTab
[
connId
]
if
conn
==
nil
{
if
conn
==
nil
{
if
nl
.
acceptq
!=
nil
{
if
nl
.
acceptq
!=
nil
{
...
@@ -345,12 +348,10 @@ func (nl *NodeLink) serveRecv() {
...
@@ -345,12 +348,10 @@ func (nl *NodeLink) serveRecv() {
}
}
// route packet to serving goroutine handler
// route packet to serving goroutine handler
// XXX what if Conn.Recv exited because of just recently close(nl.down) ?
// -> check nl.down here too ?
conn
.
rxq
<-
pkt
conn
.
rxq
<-
pkt
// keep connMu locked until here: so that ^^^ `conn.rxq <- pkt` can be
// keep connMu locked until here: so that ^^^ `conn.rxq <- pkt` can be
// sure conn stays not down e.g. closed by Conn.Close
// sure conn stays not down e.g. closed by Conn.Close
or NodeLink.shutdown
nl
.
connMu
.
Unlock
()
nl
.
connMu
.
Unlock
()
}
}
}
}
...
...
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