diff --git a/quic/safe_stream.go b/quic/safe_stream.go index 12ba76f4..c151ff2e 100644 --- a/quic/safe_stream.go +++ b/quic/safe_stream.go @@ -41,3 +41,14 @@ func (s *SafeStreamCloser) Close() error { s.stream.CancelRead(0) return s.stream.Close() } + +func (s *SafeStreamCloser) CloseWrite() error { + s.lock.Lock() + defer s.lock.Unlock() + + // As documented by the quic-go library, this doesn't actually close the entire stream. + // It prevents further writes, which in turn will result in an EOF signal being sent the other side of stream when + // reading. + // We can still read from this stream. + return s.stream.Close() +}