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

fix: wait for handshake to complete before returning #50

Merged
merged 1 commit into from
Jun 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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