mirror of
https://github.com/KusakabeShi/EtherGuard-VPN.git
synced 2025-08-14 02:04:58 +02:00
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.
This commit is contained in:
10
timers.go
10
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()
|
||||
|
Reference in New Issue
Block a user