aboutsummaryrefslogtreecommitdiffstats
path: root/timers.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-04-18 20:29:48 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-04-18 20:29:48 +0200
commitac9912345b4da5034ea93f5f245ea2ce04815bd5 (patch)
treeb371c03e54c7d1ee2c882fdf596b011a936d2ad7 /timers.go
parentAllow determining name (diff)
downloadwireguard-go-ac9912345b4da5034ea93f5f245ea2ce04815bd5.tar.xz
wireguard-go-ac9912345b4da5034ea93f5f245ea2ce04815bd5.zip
Fixed read from closed channel
A premature waitgroup .Done resulted in reading from closed channel. This caused a nil-pointer deref & crash. Added additional debugging when closing routines.
Diffstat (limited to '')
-rw-r--r--timers.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/timers.go b/timers.go
index e118c38..8725570 100644
--- a/timers.go
+++ b/timers.go
@@ -183,13 +183,15 @@ func (peer *Peer) sendNewHandshake() error {
func (peer *Peer) RoutineTimerHandler() {
- defer peer.routines.stopping.Done()
-
device := peer.device
logInfo := device.log.Info
logDebug := device.log.Debug
- logDebug.Println("Routine, timer handler, started for peer", peer.String())
+
+ defer func() {
+ logDebug.Println(peer.String(), ": Routine, Timer handler, Stopped")
+ peer.routines.stopping.Done()
+ }()
// reset all timers
@@ -205,6 +207,8 @@ func (peer *Peer) RoutineTimerHandler() {
peer.timer.keepalivePersistent.Reset(duration)
}
+ logDebug.Println("Routine, timer handler, started for peer", peer.String())
+
// signal synchronised setup complete
peer.routines.starting.Done()