We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ea5605b commit 4aed194Copy full SHA for 4aed194
session.go
@@ -536,13 +536,14 @@ func (s *Session) send() {
536
if err := s.sendLoop(); err != nil {
537
// Prefer the recvLoop error over the sendLoop error. The receive loop might have the error code
538
// received in a GoAway frame received just before the TCP RST that closed the sendLoop
539
- //
540
- // Take the shutdownLock to avoid closing the connection concurrently with a Close call.
541
s.shutdownLock.Lock()
542
- s.conn.Close()
543
- <-s.recvDoneCh
544
- if _, ok := s.recvErr.(*GoAwayError); ok {
545
- err = s.recvErr
+ if s.shutdownErr == nil {
+ s.conn.Close()
+ <-s.recvDoneCh
+ if _, ok := s.recvErr.(*GoAwayError); ok {
+ err = s.recvErr
+ }
546
+ s.shutdownErr = err
547
}
548
s.shutdownLock.Unlock()
549
s.close(err, false, 0)
0 commit comments