summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/transport/udp
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/transport/udp')
-rwxr-xr-xpkg/tcpip/transport/udp/udp_packet_list.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/pkg/tcpip/transport/udp/udp_packet_list.go b/pkg/tcpip/transport/udp/udp_packet_list.go
index 673a9373b..00535d242 100755
--- a/pkg/tcpip/transport/udp/udp_packet_list.go
+++ b/pkg/tcpip/transport/udp/udp_packet_list.go
@@ -54,8 +54,9 @@ func (l *udpPacketList) Back() *udpPacket {
// PushFront inserts the element e at the front of list l.
func (l *udpPacketList) PushFront(e *udpPacket) {
- udpPacketElementMapper{}.linkerFor(e).SetNext(l.head)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(nil)
+ linker := udpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(l.head)
+ linker.SetPrev(nil)
if l.head != nil {
udpPacketElementMapper{}.linkerFor(l.head).SetPrev(e)
@@ -68,8 +69,9 @@ func (l *udpPacketList) PushFront(e *udpPacket) {
// PushBack inserts the element e at the back of list l.
func (l *udpPacketList) PushBack(e *udpPacket) {
- udpPacketElementMapper{}.linkerFor(e).SetNext(nil)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(l.tail)
+ linker := udpPacketElementMapper{}.linkerFor(e)
+ linker.SetNext(nil)
+ linker.SetPrev(l.tail)
if l.tail != nil {
udpPacketElementMapper{}.linkerFor(l.tail).SetNext(e)
@@ -98,10 +100,14 @@ func (l *udpPacketList) PushBackList(m *udpPacketList) {
// InsertAfter inserts e after b.
func (l *udpPacketList) InsertAfter(b, e *udpPacket) {
- a := udpPacketElementMapper{}.linkerFor(b).Next()
- udpPacketElementMapper{}.linkerFor(e).SetNext(a)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- udpPacketElementMapper{}.linkerFor(b).SetNext(e)
+ bLinker := udpPacketElementMapper{}.linkerFor(b)
+ eLinker := udpPacketElementMapper{}.linkerFor(e)
+
+ a := bLinker.Next()
+
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ bLinker.SetNext(e)
if a != nil {
udpPacketElementMapper{}.linkerFor(a).SetPrev(e)
@@ -112,10 +118,13 @@ func (l *udpPacketList) InsertAfter(b, e *udpPacket) {
// InsertBefore inserts e before a.
func (l *udpPacketList) InsertBefore(a, e *udpPacket) {
- b := udpPacketElementMapper{}.linkerFor(a).Prev()
- udpPacketElementMapper{}.linkerFor(e).SetNext(a)
- udpPacketElementMapper{}.linkerFor(e).SetPrev(b)
- udpPacketElementMapper{}.linkerFor(a).SetPrev(e)
+ aLinker := udpPacketElementMapper{}.linkerFor(a)
+ eLinker := udpPacketElementMapper{}.linkerFor(e)
+
+ b := aLinker.Prev()
+ eLinker.SetNext(a)
+ eLinker.SetPrev(b)
+ aLinker.SetPrev(e)
if b != nil {
udpPacketElementMapper{}.linkerFor(b).SetNext(e)