File tree 1 file changed +9
-0
lines changed 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
117
117
go func () {
118
118
for entry := range d .entriesChan {
119
119
port := toDiscoveryPort (entry )
120
+ if port == nil {
121
+ continue
122
+ }
120
123
if updated := d .portsCache .storeOrUpdate (port ); ! updated {
121
124
// Port is not cached so let the user know a new one has been found
122
125
eventCB ("add" , port )
@@ -189,6 +192,12 @@ func (d *MDNSDiscovery) StartSync(eventCB discovery.EventCallback, errorCB disco
189
192
}
190
193
191
194
func 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
+
192
201
ip := ""
193
202
if len (entry .AddrV4 ) > 0 {
194
203
ip = entry .AddrV4 .String ()
You can’t perform that action at this time.
0 commit comments