@@ -66,7 +66,7 @@ type Discovery interface {
66
66
// StartSync is called to put the discovery in event mode. When the
67
67
// function returns the discovery must send port events ("add" or "remove")
68
68
// using the eventCB function.
69
- StartSync (eventCB EventCallback ) ( chan <- bool , error )
69
+ StartSync (eventCB EventCallback ) error
70
70
71
71
// Stop stops the discovery internal subroutines. If the discovery is
72
72
// in event mode it must stop sending events through the eventCB previously
@@ -90,7 +90,6 @@ type DiscoveryServer struct {
90
90
initialized bool
91
91
started bool
92
92
syncStarted bool
93
- syncCloseChan chan <- bool
94
93
}
95
94
96
95
// NewDiscoveryServer creates a new discovery server backed by the
@@ -224,14 +223,12 @@ func (d *DiscoveryServer) startSync() {
224
223
d .outputError ("start_sync" , "Discovery already STARTed, cannot START_SYNC" )
225
224
return
226
225
}
227
- if c , err := d .impl .StartSync (d .syncEvent ); err != nil {
226
+ if err := d .impl .StartSync (d .syncEvent ); err != nil {
228
227
d .outputError ("start_sync" , "Cannot START_SYNC: " + err .Error ())
229
228
return
230
- } else {
231
- d .syncCloseChan = c
232
- d .syncStarted = true
233
- d .outputOk ("start_sync" )
234
229
}
230
+ d .syncStarted = true
231
+ d .outputOk ("start_sync" )
235
232
}
236
233
237
234
func (d * DiscoveryServer ) stop () {
@@ -243,14 +240,8 @@ func (d *DiscoveryServer) stop() {
243
240
d .outputError ("stop" , "Cannot STOP: " + err .Error ())
244
241
return
245
242
}
246
- if d .started {
247
- d .started = false
248
- }
249
- if d .syncStarted {
250
- d .syncCloseChan <- true
251
- close (d .syncCloseChan )
252
- d .syncStarted = false
253
- }
243
+ d .started = false
244
+ d .syncStarted = false
254
245
d .outputOk ("stop" )
255
246
}
256
247
0 commit comments