Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions device_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func (s DeviceStateChangedEvent) WentOffline() bool {
}

type deviceWatcherImpl struct {
server server
server server
scanner wire.Scanner

// If an error occurs, it is stored here and eventChan is close immediately after.
err atomic.Value
Expand Down Expand Up @@ -80,7 +81,9 @@ func (w *DeviceWatcher) Err() error {
// Shutdown stops the watcher from listening for events and closes the channel returned
// from C.
func (w *DeviceWatcher) Shutdown() {
// TODO(z): Implement.
if w.scanner != nil {
w.scanner.Close()
}
}

func (w *deviceWatcherImpl) reportErr(err error) {
Expand Down Expand Up @@ -111,6 +114,7 @@ func publishDevices(watcher *deviceWatcherImpl) {
watcher.reportErr(err)
return
}
watcher.scanner = scanner

finished, err = publishDevicesUntilError(scanner, watcher.eventChan, &lastKnownStates)

Expand Down