diff --git a/peers/protocol.go b/peers/protocol.go index 53edfc7..22e9634 100644 --- a/peers/protocol.go +++ b/peers/protocol.go @@ -39,6 +39,9 @@ func newProtocolClient(ctx context.Context, rw io.ReadWriter, handler Handler) * func (c *protocolClient) Close() error { defer c.ctxCancel() + if c.ctx.Err() != nil { + return c.ctx.Err() + } return c.handler.Close() }