File tree 1 file changed +12
-0
lines changed
app/src/cc/arduino/packages/discoverers 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -120,11 +120,23 @@ public void serviceResolved(ServiceEvent serviceEvent) {
120
120
port .setProtocol ("network" );
121
121
port .setPrefs (prefs );
122
122
port .setLabel (label );
123
+
123
124
synchronized (this ) {
125
+ removeDuplicateBoards (port );
124
126
ports .add (port );
125
127
}
126
128
}
127
129
130
+ private void removeDuplicateBoards (BoardPort newBoard ) {
131
+ Iterator <BoardPort > iterator = ports .iterator ();
132
+ while (iterator .hasNext ()) {
133
+ BoardPort board = iterator .next ();
134
+ if (newBoard .getAddress ().equals (board .getAddress ()) && newBoard .getBoardName ().equals (board .getBoardName ())) {
135
+ iterator .remove ();
136
+ }
137
+ }
138
+ }
139
+
128
140
@ Override
129
141
public void inetAddressAdded (InetAddress address ) {
130
142
if (mappedJmDNSs .containsKey (address )) {
You can’t perform that action at this time.
0 commit comments