Commit d81b4538 authored by Steven Allen's avatar Steven Allen

fix: wait for handshake to complete before returning

That makes sure we aren't still writing/reading after we relinquish control.

fixes #40

may be related to https://github.com/ipfs/go-ipfs/issues/6197?
parent 20781608
......@@ -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