diff --git a/internal/multiplex/stream.go b/internal/multiplex/stream.go index d827117..90d5c16 100644 --- a/internal/multiplex/stream.go +++ b/internal/multiplex/stream.go @@ -174,9 +174,11 @@ func (s *Stream) Write(in []byte) (n int, err error) { // ReadFrom continuously read data from r and send it off, until either r returns error or nothing has been read // for readFromTimeout amount of time func (s *Stream) ReadFrom(r io.Reader) (n int64, err error) { + s.writingM.Lock() if s.obfsBuf == nil { s.obfsBuf = make([]byte, s.session.StreamSendBufferSize) } + s.writingM.Unlock() for { if s.readFromTimeout != 0 { if rder, ok := r.(net.Conn); !ok {