فهرست منبع

Fix: establishCandidateGenerator failed to always close candidateServerEntries

* establishCandidateGenerator is in charge of closing this channel
* The close is used to ensure all establishTunnelWorker goroutines stop
* In the missing case, an early return on error, the controller would fail to halt
Rod Hynes 11 سال پیش
والد
کامیت
cab12ff0ea
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      psiphon/controller.go

+ 1 - 1
psiphon/controller.go

@@ -528,6 +528,7 @@ func (controller *Controller) stopEstablishing() {
 // servers with higher rank are priority candidates.
 func (controller *Controller) establishCandidateGenerator() {
 	defer controller.establishWaitGroup.Done()
+	defer close(controller.candidateServerEntries)
 
 	iterator, err := NewServerEntryIterator(controller.config)
 	if err != nil {
@@ -576,7 +577,6 @@ loop:
 		}
 	}
 
-	close(controller.candidateServerEntries)
 	NoticeInfo("stopped candidate generator")
 }