p2p: use correct context error (#8916) (#8920)

handshakeCtx is the internal context carrying the timeout. Its error should be used for the error return.

(cherry picked from commit 921530c352)

Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
Co-authored-by: Sam Kleinman <garen@tychoish.com>
Co-authored-by: Callum Waters <cmwaters19@gmail.com>
This commit is contained in:
mergify[bot]
2022-07-05 13:36:26 -04:00
committed by GitHub
parent e414d0a878
commit 49788adde5

View File

@@ -296,7 +296,7 @@ func (c *mConnConnection) Handshake(
select {
case <-handshakeCtx.Done():
_ = c.Close()
return types.NodeInfo{}, nil, ctx.Err()
return types.NodeInfo{}, nil, handshakeCtx.Err()
case err := <-errCh:
if err != nil {