Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return rootcause shutdown error from yamux #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func (s *Session) waitForSendErr(hdr header, body []byte, errCh chan error) erro
select {
case s.sendCh <- ready:
case <-s.shutdownCh:
return ErrSessionShutdown
return s.shutdownErr
case <-timer.C:
return ErrConnectionWriteTimeout
}
Expand Down Expand Up @@ -435,7 +435,7 @@ func (s *Session) waitForSendErr(hdr header, body []byte, errCh chan error) erro
return err
case <-s.shutdownCh:
bodyCopy()
return ErrSessionShutdown
return s.shutdownErr
case <-timer.C:
bodyCopy()
return ErrConnectionWriteTimeout
Expand Down
8 changes: 4 additions & 4 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ START:

// Send a window update potentially
err = s.sendWindowUpdate()
if err == ErrSessionShutdown {
if s.session.IsClosed() {
err = nil
}
return n, err
Expand Down Expand Up @@ -213,7 +213,7 @@ START:
// Send the header
s.sendHdr.encode(typeData, flags, s.id, max)
if err = s.session.waitForSendErr(s.sendHdr, body, s.sendErr); err != nil {
if errors.Is(err, ErrSessionShutdown) || errors.Is(err, ErrConnectionWriteTimeout) {
if s.session.IsClosed() || errors.Is(err, ErrConnectionWriteTimeout) {
// Message left in ready queue, header re-use is unsafe.
s.sendHdr = header(make([]byte, headerSize))
}
Expand Down Expand Up @@ -297,7 +297,7 @@ func (s *Stream) sendWindowUpdate() error {
// Send the header
s.controlHdr.encode(typeWindowUpdate, flags, s.id, delta)
if err := s.session.waitForSendErr(s.controlHdr, nil, s.controlErr); err != nil {
if errors.Is(err, ErrSessionShutdown) || errors.Is(err, ErrConnectionWriteTimeout) {
if s.session.IsClosed() || errors.Is(err, ErrConnectionWriteTimeout) {
// Message left in ready queue, header re-use is unsafe.
s.controlHdr = header(make([]byte, headerSize))
}
Expand All @@ -315,7 +315,7 @@ func (s *Stream) sendClose() error {
flags |= flagFIN
s.controlHdr.encode(typeWindowUpdate, flags, s.id, 0)
if err := s.session.waitForSendErr(s.controlHdr, nil, s.controlErr); err != nil {
if errors.Is(err, ErrSessionShutdown) || errors.Is(err, ErrConnectionWriteTimeout) {
if s.session.IsClosed() || errors.Is(err, ErrConnectionWriteTimeout) {
// Message left in ready queue, header re-use is unsafe.
s.controlHdr = header(make([]byte, headerSize))
}
Expand Down