Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #50 from libp2p/fix/wait-on-handshake
Browse files Browse the repository at this point in the history
fix: wait for handshake to complete before returning
  • Loading branch information
Stebalien authored Jun 15, 2019
2 parents 2078160 + d81b453 commit 94b9134
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ func (s *secureSession) runHandshake(ctx context.Context) error {
var err error
select {
case <-ctx.Done():
err = ctx.Err()

// State unknown. We *have* to close this.
s.insecure.Close()
err = ctx.Err()
// Wait for the handshake to return.
<-result
case err = <-result:
}
return err
Expand Down

0 comments on commit 94b9134

Please sign in to comment.