diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-03-02 20:03:00 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-02 20:03:00 +0000 |
commit | 2083ef0f257e37ec40d9b70cae51edd509be329d (patch) | |
tree | c3272e63a8d30f9598bd0d3122df28cf934fa392 /pkg/tcpip/stack/pending_packets.go | |
parent | 6b785c5e3d79cb32ce49dec2aa97bec8e9725409 (diff) | |
parent | 6bc27946a6cb159ecbe049acff888d0041d4a432 (diff) |
Merge release-20210208.0-107-g6bc27946a (automated)
Diffstat (limited to 'pkg/tcpip/stack/pending_packets.go')
-rw-r--r-- | pkg/tcpip/stack/pending_packets.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/tcpip/stack/pending_packets.go b/pkg/tcpip/stack/pending_packets.go index dc139ebb2..e936aa728 100644 --- a/pkg/tcpip/stack/pending_packets.go +++ b/pkg/tcpip/stack/pending_packets.go @@ -91,9 +91,9 @@ func (f *packetsPendingLinkResolution) init(nic *nic) { // dequeue any pending packets associated with ch. // -// If success is true, packets will be written and sent to the given remote link +// If err is nil, packets will be written and sent to the given remote link // address. -func (f *packetsPendingLinkResolution) dequeue(ch <-chan struct{}, linkAddr tcpip.LinkAddress, success bool) { +func (f *packetsPendingLinkResolution) dequeue(ch <-chan struct{}, linkAddr tcpip.LinkAddress, err tcpip.Error) { f.mu.Lock() packets, ok := f.mu.packets[ch] delete(f.mu.packets, ch) @@ -110,7 +110,7 @@ func (f *packetsPendingLinkResolution) dequeue(ch <-chan struct{}, linkAddr tcpi f.mu.Unlock() if ok { - f.dequeuePackets(packets, linkAddr, success) + f.dequeuePackets(packets, linkAddr, err) } } @@ -176,7 +176,7 @@ func (f *packetsPendingLinkResolution) enqueue(r *Route, gso *GSO, proto tcpip.N if len(cancelledPackets) != 0 { // Dequeue the pending packets in a new goroutine to not hold up the current // goroutine as handing link resolution failures may be a costly operation. - go f.dequeuePackets(cancelledPackets, "" /* linkAddr */, false /* success */) + go f.dequeuePackets(cancelledPackets, "" /* linkAddr */, &tcpip.ErrAborted{}) } return pkt.len(), nil @@ -207,9 +207,9 @@ func (f *packetsPendingLinkResolution) newCancelChannelLocked(newCH <-chan struc return packets } -func (f *packetsPendingLinkResolution) dequeuePackets(packets []pendingPacket, linkAddr tcpip.LinkAddress, success bool) { +func (f *packetsPendingLinkResolution) dequeuePackets(packets []pendingPacket, linkAddr tcpip.LinkAddress, err tcpip.Error) { for _, p := range packets { - if success { + if err == nil { p.routeInfo.RemoteLinkAddress = linkAddr _, _ = f.nic.writePacketBuffer(p.routeInfo, p.gso, p.proto, p.pkt) } else { |