diff options
author | Ian Gudger <igudger@google.com> | 2018-11-14 11:57:58 -0800 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-11-14 11:58:41 -0800 |
commit | b5e91eaa52cfb9b43dff0f857938ca231068924d (patch) | |
tree | 7f18747e8e6166537b8be175a6de188f028b8002 /pkg/tcpip/transport/tcp | |
parent | 7b938ef78c2b180d1d0554534972069ec393322d (diff) |
Clean up tcp.sendData
PiperOrigin-RevId: 221484739
Change-Id: I44c71f79f99d0d00a2e70a7f06d7024a62a5de0a
Diffstat (limited to 'pkg/tcpip/transport/tcp')
-rw-r--r-- | pkg/tcpip/transport/tcp/snd.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/pkg/tcpip/transport/tcp/snd.go b/pkg/tcpip/transport/tcp/snd.go index f6dc7520b..b47e279fc 100644 --- a/pkg/tcpip/transport/tcp/snd.go +++ b/pkg/tcpip/transport/tcp/snd.go @@ -404,8 +404,7 @@ func (s *sender) sendData() { seg := s.writeNext end := s.sndUna.Add(s.sndWnd) var dataSent bool - for next := (*segment)(nil); seg != nil && s.outstanding < s.sndCwnd; seg = next { - next = seg.Next() + for ; seg != nil && s.outstanding < s.sndCwnd; seg = seg.Next() { // We abuse the flags field to determine if we have already // assigned a sequence number to this segment. @@ -428,17 +427,16 @@ func (s *sender) sendData() { // in poorly written DNS implementations. var nextTooBig bool - for next != nil && next.data.Size() != 0 { - if seg.data.Size()+next.data.Size() > available { + for seg.Next() != nil && seg.Next().data.Size() != 0 { + if seg.data.Size()+seg.Next().data.Size() > available { nextTooBig = true break } - seg.data.Append(&next.data) + seg.data.Append(seg.Next().data) // Consume the segment that we just merged in. - s.writeList.Remove(next) - next = next.Next() + s.writeList.Remove(seg.Next()) } if !nextTooBig && seg.data.Size() < available { @@ -496,7 +494,6 @@ func (s *sender) sendData() { nSeg.data.TrimFront(available) nSeg.sequenceNumber.UpdateForward(seqnum.Size(available)) s.writeList.InsertAfter(seg, nSeg) - next = nSeg seg.data.CapLength(available) } |