forked from quic-go/quic-go
fix a race condition in session.handleWindowUpdateFrame
This commit is contained in:
@@ -336,6 +336,7 @@ func (s *Session) handleWindowUpdateFrame(frame *frames.WindowUpdateFrame) error
|
|||||||
s.streamsMutex.RUnlock()
|
s.streamsMutex.RUnlock()
|
||||||
} else {
|
} else {
|
||||||
s.streamsMutex.RLock()
|
s.streamsMutex.RLock()
|
||||||
|
defer s.streamsMutex.RUnlock()
|
||||||
stream, streamExists := s.streams[frame.StreamID]
|
stream, streamExists := s.streams[frame.StreamID]
|
||||||
if !streamExists {
|
if !streamExists {
|
||||||
return errWindowUpdateOnInvalidStream
|
return errWindowUpdateOnInvalidStream
|
||||||
@@ -343,7 +344,6 @@ func (s *Session) handleWindowUpdateFrame(frame *frames.WindowUpdateFrame) error
|
|||||||
if stream == nil {
|
if stream == nil {
|
||||||
return errWindowUpdateOnClosedStream
|
return errWindowUpdateOnClosedStream
|
||||||
}
|
}
|
||||||
s.streamsMutex.RUnlock()
|
|
||||||
|
|
||||||
updated := stream.UpdateSendFlowControlWindow(frame.ByteOffset)
|
updated := stream.UpdateSendFlowControlWindow(frame.ByteOffset)
|
||||||
if updated {
|
if updated {
|
||||||
|
|||||||
Reference in New Issue
Block a user