aboutsummaryrefslogtreecommitdiffstats
path: root/receive.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 22:20:15 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-16 22:20:15 +0200
commit846d721dfd0cde953f2e9304d6ef50110de050eb (patch)
tree8de15914ab39d0aad1b50d03530b82fece54c740 /receive.go
parentFix dir permissions (diff)
downloadwireguard-go-846d721dfd0cde953f2e9304d6ef50110de050eb.tar.xz
wireguard-go-846d721dfd0cde953f2e9304d6ef50110de050eb.zip
Finer-grained start-stop synchronization
Diffstat (limited to '')
-rw-r--r--receive.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/receive.go b/receive.go
index 77062fa..aa96057 100644
--- a/receive.go
+++ b/receive.go
@@ -124,9 +124,11 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
logDebug := device.log.Debug
defer func() {
logDebug.Println("Routine: receive incoming IPv" + strconv.Itoa(IP) + " - stopped")
+ device.state.stopping.Done()
}()
logDebug.Println("Routine: receive incoming IPv" + strconv.Itoa(IP) + " - starting")
+ device.state.starting.Done()
// receive datagrams until conn is closed
@@ -257,6 +259,7 @@ func (device *Device) RoutineDecryption() {
device.state.stopping.Done()
}()
logDebug.Println("Routine: decryption worker - started")
+ device.state.starting.Done()
for {
select {
@@ -324,6 +327,7 @@ func (device *Device) RoutineHandshake() {
}()
logDebug.Println("Routine: handshake worker - started")
+ device.state.starting.Done()
var elem QueueHandshakeElement
var ok bool