Skip to content
Merged
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
6 changes: 3 additions & 3 deletions sync/sync_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ func Start(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) (ch
// Output initial port state: get the current port list to send as initial "add" events
current, err := enumerator.GetDetailedPortsList()
if err != nil {
// TODO: how to handle errors? should we just retry silently?
errorCB(err.Error())
return
}
for _, port := range current {
eventCB("add", toDiscoveryPort(port))
Expand All @@ -71,7 +72,7 @@ func Start(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) (ch
events := make([]syscall.Kevent_t, 10)

for {
t100ms := syscall.Timespec{Nsec: 100000000, Sec: 0}
t100ms := syscall.Timespec{Nsec: 100_000_000, Sec: 0}
n, err := syscall.Kevent(kq, []syscall.Kevent_t{ev1}, events, &t100ms)
select {
case <-closeChan:
Expand All @@ -92,7 +93,6 @@ func Start(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) (ch
// if there is an event retry up to 5 times
var enumeratorErr error
for retries := 0; retries < 5; retries++ {
retries--
updates, err := enumerator.GetDetailedPortsList()
if err != nil {
enumeratorErr = err
Expand Down