diff --git a/session.go b/session.go index 5dff307..c1fb864 100644 --- a/session.go +++ b/session.go @@ -328,6 +328,10 @@ func (s *Session) waitForSendErr(hdr header, body io.Reader, errCh chan error) e timer.Reset(s.config.ConnectionWriteTimeout) defer func() { timer.Stop() + select { + case <-timer.C: + default: + } timerPool.Put(t) }() @@ -359,6 +363,10 @@ func (s *Session) sendNoWait(hdr header) error { timer.Reset(s.config.ConnectionWriteTimeout) defer func() { timer.Stop() + select { + case <-timer.C: + default: + } timerPool.Put(t) }() @@ -418,6 +426,7 @@ func (s *Session) recv() { } } +// Ensure that the index of the handler (typeData/typeWindowUpdate/etc) matches the message type var ( handlers = []func(*Session, header) error{ typeData: (*Session).handleStreamMessage,