Only stop timers if they are running

This commit is contained in:
Neil Alexander 2019-09-18 15:34:26 +01:00
parent 366fe7e772
commit c78a4cb28f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 10 additions and 7 deletions

View file

@ -75,8 +75,12 @@ func (m *Multicast) Start() error {
// Stop is not implemented for multicast yet.
func (m *Multicast) Stop() error {
m.isOpen = false
m.announcer.Stop()
m.platformhandler.Stop()
if m.announcer != nil {
m.announcer.Stop()
}
if m.platformhandler != nil {
m.platformhandler.Stop()
}
m.sock.Close()
return nil
}