From 39abe7ed206a6ddee6689eb2179f07d8ba8fc358 Mon Sep 17 00:00:00 2001 From: sukun Date: Wed, 20 Nov 2024 15:33:19 +0530 Subject: [PATCH] use ErrStreamReset for resetting streams --- session.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/session.go b/session.go index 6fb6731..e229730 100644 --- a/session.go +++ b/session.go @@ -325,10 +325,14 @@ func (s *Session) close(shutdownErr error, sendGoAway bool, errCode uint32) erro <-s.sendDoneCh <-s.recvDoneCh + resetErr := shutdownErr + if _, ok := resetErr.(*GoAwayError); !ok { + resetErr = fmt.Errorf("%w: connection closed: %w", ErrStreamReset, shutdownErr) + } s.streamLock.Lock() defer s.streamLock.Unlock() for id, stream := range s.streams { - stream.forceClose(s.shutdownErr) + stream.forceClose(resetErr) delete(s.streams, id) stream.memorySpan.Done() }