Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-tls
Commits
141af4b2
Unverified
Commit
141af4b2
authored
Nov 01, 2019
by
Steven Allen
Committed by
GitHub
Nov 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #37 from libp2p/fix/handshake-cancelled
Fix: Connection Closed after handshake
parents
32417a40
d3cafc00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
transport.go
transport.go
+11
-0
No files found.
transport.go
View file @
141af4b2
...
...
@@ -6,6 +6,7 @@ import (
"errors"
"net"
"os"
"sync"
ci
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"
...
...
@@ -81,9 +82,19 @@ func (t *Transport) handshake(
tlsConn
.
Close
()
default
:
}
done
:=
make
(
chan
struct
{})
var
wg
sync
.
WaitGroup
// Ensure that we do not return before
// either being done or having a context
// cancellation.
defer
wg
.
Wait
()
defer
close
(
done
)
wg
.
Add
(
1
)
go
func
()
{
defer
wg
.
Done
()
select
{
case
<-
done
:
case
<-
ctx
.
Done
()
:
...
...
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