diff --git a/internal/multiplex/stream.go b/internal/multiplex/stream.go index b23ac27..84ef6dc 100644 --- a/internal/multiplex/stream.go +++ b/internal/multiplex/stream.go @@ -120,6 +120,12 @@ func (stream *Stream) passiveClose() { func (stream *Stream) Close() error { stream.writingM.Lock() + select { + case <-stream.die: + stream.writingM.Unlock() + return errors.New("Already Closed") + default: + } stream.heliumMask.Do(func() { close(stream.die) }) // Notify remote that this stream is closed