File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,9 @@ func (d *MDNSDiscovery) StartSync(eventCB discovery.EventCallback, errorCB disco
117117 go func () {
118118 for entry := range d .entriesChan {
119119 port := toDiscoveryPort (entry )
120+ if port == nil {
121+ continue
122+ }
120123 if updated := d .portsCache .storeOrUpdate (port ); ! updated {
121124 // Port is not cached so let the user know a new one has been found
122125 eventCB ("add" , port )
@@ -189,6 +192,12 @@ func (d *MDNSDiscovery) StartSync(eventCB discovery.EventCallback, errorCB disco
189192}
190193
191194func toDiscoveryPort (entry * mdns.ServiceEntry ) * discovery.Port {
195+ // Only entries that match the Arduino OTA service name must
196+ // be returned
197+ if ! strings .HasSuffix (entry .Name , mdnsServiceName + ".local." ) {
198+ return nil
199+ }
200+
192201 ip := ""
193202 if len (entry .AddrV4 ) > 0 {
194203 ip = entry .AddrV4 .String ()
You can’t perform that action at this time.
0 commit comments