File tree 1 file changed +10
-10
lines changed 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -1403,6 +1403,16 @@ func (c *Conn) HandshakeContext(ctx context.Context) error {
1403
1403
}
1404
1404
1405
1405
func (c * Conn ) handshakeContext (ctx context.Context ) (ret error ) {
1406
+ c .handshakeMutex .Lock ()
1407
+ defer c .handshakeMutex .Unlock ()
1408
+
1409
+ if err := c .handshakeErr ; err != nil {
1410
+ return err
1411
+ }
1412
+ if c .handshakeComplete () {
1413
+ return nil
1414
+ }
1415
+
1406
1416
handshakeCtx , cancel := context .WithCancel (ctx )
1407
1417
// Note: defer this before starting the "interrupter" goroutine
1408
1418
// so that we can tell the difference between the input being canceled and
@@ -1436,16 +1446,6 @@ func (c *Conn) handshakeContext(ctx context.Context) (ret error) {
1436
1446
}()
1437
1447
}
1438
1448
1439
- c .handshakeMutex .Lock ()
1440
- defer c .handshakeMutex .Unlock ()
1441
-
1442
- if err := c .handshakeErr ; err != nil {
1443
- return err
1444
- }
1445
- if c .handshakeComplete () {
1446
- return nil
1447
- }
1448
-
1449
1449
c .in .Lock ()
1450
1450
defer c .in .Unlock ()
1451
1451
You can’t perform that action at this time.
0 commit comments