Finer-grained start-stop synchronization

This commit is contained in:
Jason A. Donenfeld
2018-05-16 22:20:15 +02:00
parent 23eca94508
commit 846d721dfd
6 changed files with 33 additions and 5 deletions

View File

@@ -247,9 +247,11 @@ func (device *Device) RoutineReadFromTUN() {
defer func() {
logDebug.Println("Routine: TUN reader - stopped")
device.state.stopping.Done()
}()
logDebug.Println("Routine: TUN reader - started")
device.state.starting.Done()
for {
@@ -424,6 +426,7 @@ func (device *Device) RoutineEncryption() {
}()
logDebug.Println("Routine: encryption worker - started")
device.state.starting.Done()
for {