Browse Source

Merge pull request #654 from AudriusButkevicius/disco

Check if global discovery was actually started before trying to stop it (fixes #653)
Jakob Borg 11 years ago
parent
commit
a617846f0f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      discover/discover.go

+ 4 - 2
discover/discover.go

@@ -108,8 +108,10 @@ func (d *Discoverer) StartGlobal(server string, extPort uint16) {
 }
 
 func (d *Discoverer) StopGlobal() {
-	close(d.stopGlobal)
-	d.globalWG.Wait()
+	if d.stopGlobal != nil {
+		close(d.stopGlobal)
+		d.globalWG.Wait()
+	}
 }
 
 func (d *Discoverer) ExtAnnounceOK() bool {