summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-03-12 03:42:14 +0000
committergVisor bot <gvisor-bot@google.com>2020-03-12 03:42:14 +0000
commit5518c7948d487c9d49aabea1e9907668ea4390d6 (patch)
treeb7c53c17139377ac23d7aaf9fa532a13f5ce5186 /pkg
parent240c2c4319e7ab87d0f15d29eb381121133b5b72 (diff)
parentac05043525a058e22a5db422e5f8d344df21fa55 (diff)
Merge release-20200219.0-155-gac05043 (automated)
Diffstat (limited to 'pkg')
-rw-r--r--pkg/tcpip/transport/tcp/segment_heap.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/tcpip/transport/tcp/segment_heap.go b/pkg/tcpip/transport/tcp/segment_heap.go
index e28f213ba..8d3ddce4b 100644
--- a/pkg/tcpip/transport/tcp/segment_heap.go
+++ b/pkg/tcpip/transport/tcp/segment_heap.go
@@ -14,21 +14,25 @@
package tcp
+import "container/heap"
+
type segmentHeap []*segment
+var _ heap.Interface = (*segmentHeap)(nil)
+
// Len returns the length of h.
-func (h segmentHeap) Len() int {
- return len(h)
+func (h *segmentHeap) Len() int {
+ return len(*h)
}
// Less determines whether the i-th element of h is less than the j-th element.
-func (h segmentHeap) Less(i, j int) bool {
- return h[i].sequenceNumber.LessThan(h[j].sequenceNumber)
+func (h *segmentHeap) Less(i, j int) bool {
+ return (*h)[i].sequenceNumber.LessThan((*h)[j].sequenceNumber)
}
// Swap swaps the i-th and j-th elements of h.
-func (h segmentHeap) Swap(i, j int) {
- h[i], h[j] = h[j], h[i]
+func (h *segmentHeap) Swap(i, j int) {
+ (*h)[i], (*h)[j] = (*h)[j], (*h)[i]
}
// Push adds x as the last element of h.