mirror of https://github.com/cbeuw/Cloak
Stop repetitive closing
This commit is contained in:
parent
4b6ab1b4d5
commit
e31aef3030
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue