diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-29 18:34:43 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-29 18:34:43 +0000 |
commit | 44f50b440fa6241105a90f17501417ed0b34f172 (patch) | |
tree | d92f8bc644c5f74a9d49b264ffd36f56ccc1775e /pkg/tcpip/network/fragmentation/reassembler.go | |
parent | 9a75e42c9700d7452e31aed3fea62a51e60671c1 (diff) | |
parent | f15182243e508b0754d59350a886397e2a0ba0b2 (diff) |
Merge release-20200921.0-63-gf15182243 (automated)
Diffstat (limited to 'pkg/tcpip/network/fragmentation/reassembler.go')
-rw-r--r-- | pkg/tcpip/network/fragmentation/reassembler.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pkg/tcpip/network/fragmentation/reassembler.go b/pkg/tcpip/network/fragmentation/reassembler.go index f044867dc..9bb051a30 100644 --- a/pkg/tcpip/network/fragmentation/reassembler.go +++ b/pkg/tcpip/network/fragmentation/reassembler.go @@ -18,9 +18,9 @@ import ( "container/heap" "fmt" "math" - "time" "gvisor.dev/gvisor/pkg/sync" + "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/buffer" ) @@ -40,15 +40,15 @@ type reassembler struct { deleted int heap fragHeap done bool - creationTime time.Time + creationTime int64 } -func newReassembler(id FragmentID) *reassembler { +func newReassembler(id FragmentID, clock tcpip.Clock) *reassembler { r := &reassembler{ id: id, holes: make([]hole, 0, 16), heap: make(fragHeap, 0, 8), - creationTime: time.Now(), + creationTime: clock.NowMonotonic(), } r.holes = append(r.holes, hole{ first: 0, @@ -116,10 +116,6 @@ func (r *reassembler) process(first, last uint16, more bool, proto uint8, vv buf return res, r.proto, true, consumed, nil } -func (r *reassembler) tooOld(timeout time.Duration) bool { - return time.Now().Sub(r.creationTime) > timeout -} - func (r *reassembler) checkDoneOrMark() bool { r.mu.Lock() prev := r.done |