fix a race condition in stream.Write

This commit is contained in:
Lucas Clemente
2016-08-05 10:00:54 +02:00
parent f5315af4db
commit 62b06a003c

View File

@@ -138,7 +138,7 @@ func (s *stream) Write(p []byte) (int, error) {
s.doneWritingOrErrCond.Wait() s.doneWritingOrErrCond.Wait()
} }
s.mutex.Unlock() defer s.mutex.Unlock()
if s.err != nil { if s.err != nil {
return 0, s.err return 0, s.err
} }