Skip to content

Commit

Permalink
Make sure all mDNS entries will be handled (#44)
Browse files Browse the repository at this point in the history
Fixes #43

This fixes an issue if mDNS entries are found very quickly and the
reporting callback wasn’t setup yet, the system wouldn’t initiate a
connection to the found service.
  • Loading branch information
DerAndereAndi authored Nov 18, 2024
2 parents 69e26eb + f4eb5bd commit 3ca32da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mdns/mdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ func (m *MdnsManager) Start(cb api.MdnsReportInterface) error {
return err
}

// assign the cb before mDNS is initialised, so that we don't miss any found services
m.report = cb

switch m.providerSelection {
case MdnsProviderSelectionAll:
// First try avahi, if not available use zerconf
Expand Down Expand Up @@ -191,8 +194,6 @@ func (m *MdnsManager) Start(cb api.MdnsReportInterface) error {
return err
}

m.report = cb

// catch signals
go func() {
signalC := make(chan os.Signal, 1)
Expand Down

0 comments on commit 3ca32da

Please sign in to comment.