diff --git a/transport.go b/transport.go index 15ecc6e..6a25f1d 100644 --- a/transport.go +++ b/transport.go @@ -1933,7 +1933,13 @@ func (rl *clientConnReadLoop) cleanup() { } cc.closed = true for _, cs := range cc.streams { - cs.abortStreamLocked(err) + select { + case <-cs.peerClosed: + // The server closed the stream before closing the conn, + // so no need to interrupt it. + default: + cs.abortStreamLocked(err) + } } cc.cond.Broadcast() cc.mu.Unlock()