tstest/natlab: simplify a defer

Updates #13038

Change-Id: I4d38701491523c64c81767b0838010609e683a9f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/13267/head
Brad Fitzpatrick 3 months ago committed by Brad Fitzpatrick
parent cccacff564
commit e0bdd5d058

@ -832,9 +832,7 @@ func (s *Server) ServeUnixConn(uc *net.UnixConn, proto Protocol) {
if _, ok := srcNode.net.writers.Load(srcMAC); !ok { if _, ok := srcNode.net.writers.Load(srcMAC); !ok {
log.Printf("[conn %p] Registering writer for MAC %v is node %v", uc, srcMAC, srcNode.lanIP) log.Printf("[conn %p] Registering writer for MAC %v is node %v", uc, srcMAC, srcNode.lanIP)
srcNode.net.registerWriter(srcMAC, raddr, srcNode.interfaceID, writePkt) srcNode.net.registerWriter(srcMAC, raddr, srcNode.interfaceID, writePkt)
defer func() { defer srcNode.net.registerWriter(srcMAC, nil, 0, nil)
srcNode.net.registerWriter(srcMAC, nil, 0, nil)
}()
continue continue
} }

Loading…
Cancel
Save