From 69fe86edf0ba371b9b0a54e522ec20d33e0ae129 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Tue, 14 Nov 2017 16:27:53 +0100 Subject: Initial working source caching --- src/conn.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/conn.go') diff --git a/src/conn.go b/src/conn.go index 0347262..a047bb6 100644 --- a/src/conn.go +++ b/src/conn.go @@ -2,6 +2,8 @@ package main import ( "errors" + "golang.org/x/net/ipv4" + "golang.org/x/net/ipv6" "net" ) @@ -42,7 +44,6 @@ func unsafeCloseUDPListener(device *Device) error { if netc.bind != nil { err = netc.bind.Close() netc.bind = nil - netc.update.Add(1) } return err } @@ -68,6 +69,8 @@ func UpdateUDPListener(device *Device) error { if device.tun.isUp.Get() { + device.log.Debug.Println("UDP bind updating") + // bind to new port var err error @@ -94,8 +97,10 @@ func UpdateUDPListener(device *Device) error { // decrease waitgroup to 0 + go device.RoutineReceiveIncomming(ipv4.Version, netc.bind) + go device.RoutineReceiveIncomming(ipv6.Version, netc.bind) + device.log.Debug.Println("UDP bind has been updated") - netc.update.Done() } return nil -- cgit v1.2.3