aboutsummaryrefslogtreecommitdiffstats
path: root/src/conn.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-14 16:27:53 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-11-14 16:27:53 +0100
commit69fe86edf0ba371b9b0a54e522ec20d33e0ae129 (patch)
treed2787000c41a9790feb03f5d5dc40e124d10f697 /src/conn.go
parentFixed blocking reader on closed socket (diff)
downloadwireguard-go-69fe86edf0ba371b9b0a54e522ec20d33e0ae129.tar.xz
wireguard-go-69fe86edf0ba371b9b0a54e522ec20d33e0ae129.zip
Initial working source caching
Diffstat (limited to 'src/conn.go')
-rw-r--r--src/conn.go9
1 files changed, 7 insertions, 2 deletions
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