fix race condition in stream writing

pull/123/head v1.11.1
v2ray 2016-04-19 10:30:42 +02:00
parent 1f99b769ba
commit 1732d33ba9
1 changed files with 3 additions and 0 deletions

View File

@ -77,6 +77,9 @@ func (this *Stream) Write(data *alloc.Buffer) error {
} }
this.access.RLock() this.access.RLock()
defer this.access.RUnlock() defer this.access.RUnlock()
if this.closed {
return io.EOF
}
if this.buffer == nil { if this.buffer == nil {
return io.EOF return io.EOF
} }