Unverified Commit 94b91345 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #50 from libp2p/fix/wait-on-handshake

fix: wait for handshake to complete before returning
parents 20781608 d81b4538
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment