forked from quic-go/quic-go
gracefully handle concurrent stream writes and cancellations
If the complete slice passed to Stream.Write() is sent out, and the stream is canceled concurrently (either by calling Stream.CancelWrite() or by receiving a STOP_SENDING frame), we don't need to return an error for the Write() call.
This commit is contained in:
@@ -173,6 +173,9 @@ func (s *sendStream) Write(p []byte) (int, error) {
|
||||
s.mutex.Lock()
|
||||
}
|
||||
|
||||
if bytesWritten == len(p) {
|
||||
return bytesWritten, nil
|
||||
}
|
||||
if s.closeForShutdownErr != nil {
|
||||
return bytesWritten, s.closeForShutdownErr
|
||||
} else if s.cancelWriteErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user