Merge pull request #1030 from lucas-clemente/fix-1029

when the stream write deadline expires, return the data length written
This commit is contained in:
Marten Seemann 2017-12-14 23:13:44 +07:00 committed by GitHub
commit 93e99e239c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View file

@ -243,13 +243,10 @@ func (s *stream) Write(p []byte) (int, error) {
s.mutex.Lock()
}
if err != nil {
return 0, err
}
if s.err != nil {
return len(p) - len(s.dataForWriting), s.err
err = s.err
}
return len(p), nil
return len(p) - len(s.dataForWriting), err
}
func (s *stream) GetWriteOffset() protocol.ByteCount {