From e0bdd5d058cf65f3e7b8738baf20dda2057f51f9 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 24 Aug 2024 18:04:06 -0700 Subject: [PATCH] tstest/natlab: simplify a defer Updates #13038 Change-Id: I4d38701491523c64c81767b0838010609e683a9f Signed-off-by: Brad Fitzpatrick --- tstest/natlab/vnet/vnet.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tstest/natlab/vnet/vnet.go b/tstest/natlab/vnet/vnet.go index cc47f1b89..b23bf4342 100644 --- a/tstest/natlab/vnet/vnet.go +++ b/tstest/natlab/vnet/vnet.go @@ -832,9 +832,7 @@ func (s *Server) ServeUnixConn(uc *net.UnixConn, proto Protocol) { if _, ok := srcNode.net.writers.Load(srcMAC); !ok { log.Printf("[conn %p] Registering writer for MAC %v is node %v", uc, srcMAC, srcNode.lanIP) srcNode.net.registerWriter(srcMAC, raddr, srcNode.interfaceID, writePkt) - defer func() { - srcNode.net.registerWriter(srcMAC, nil, 0, nil) - }() + defer srcNode.net.registerWriter(srcMAC, nil, 0, nil) continue }