replace stream.LenOfDataForWriting by HasDataForWriting

The return value (the length of data for writing) was only used to
determine if the stream has data for writing. Therefore it's easier to
just return a bool.

No functional change expected.
This commit is contained in:
Marten Seemann 2017-12-07 18:19:11 +07:00
parent 62a664f5f4
commit 085624be20
5 changed files with 40 additions and 42 deletions

View file

@ -54,7 +54,7 @@ func (f *streamFramer) HasFramesForRetransmission() bool {
}
func (f *streamFramer) HasCryptoStreamFrame() bool {
return f.cryptoStream.LenOfDataForWriting() > 0
return f.cryptoStream.HasDataForWriting()
}
// TODO(lclemente): This is somewhat duplicate with the normal path for generating frames.
@ -116,7 +116,7 @@ func (f *streamFramer) maybePopNormalFrames(maxBytes protocol.ByteCount) (res []
maxLen := maxBytes - currentLen - frameHeaderBytes
var data []byte
if s.LenOfDataForWriting() > 0 {
if s.HasDataForWriting() {
data = s.GetDataForWriting(maxLen)
}