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
036e98c7
Commit
036e98c7
authored
Jul 06, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a3dc8357
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
go/neo/neonet/newlink.go
go/neo/neonet/newlink.go
+10
-11
No files found.
go/neo/neonet/newlink.go
View file @
036e98c7
...
...
@@ -80,7 +80,6 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
txWg
.
Done
()
}()
// rx handshake word
go
func
()
{
var
b
[
4
]
byte
...
...
@@ -100,9 +99,9 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
connClosed
:=
false
defer
func
()
{
// make sure our version is always sent on the wire, if possible,
// so that peer does not see just closed connection when on rx we see version mismatch
// so that peer does not see just closed connection when on rx we see version mismatch
.
//
// NOTE if cancelled tx goroutine will wake up without delay
// NOTE if cancelled tx goroutine will wake up without delay
.
txWg
.
Wait
()
// don't forget to close conn if returning with error + add handshake err context
...
...
@@ -114,7 +113,6 @@ func handshake(ctx context.Context, conn net.Conn, version uint32) (err error) {
}
}()
for
i
:=
0
;
i
<
2
;
i
++
{
select
{
case
<-
ctx
.
Done
()
:
...
...
@@ -184,10 +182,11 @@ type LinkListener interface {
Accept
()
(
*
NodeLink
,
error
)
}
// linkListener implements LinkListener.
type
linkListener
struct
{
l
net
.
Listener
acceptq
chan
linkAccepted
closed
chan
struct
{}
closed
chan
struct
{}
}
type
linkAccepted
struct
{
...
...
@@ -252,7 +251,7 @@ func (l *linkListener) accept1(ctx context.Context, conn net.Conn, err error) (*
}
func
(
l
*
linkListener
)
Accept
()
(
*
NodeLink
,
error
)
{
select
{
select
{
case
<-
l
.
closed
:
// we know raw listener is already closed - return proper error about it
_
,
err
:=
l
.
l
.
Accept
()
...
...
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