mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
[191207] DNS-SD adds duplicated transport attribute when discovery is refreshed
This commit is contained in:
parent
2781ca39f7
commit
ac4fed2b3c
1 changed files with 28 additions and 5 deletions
|
@ -8,6 +8,7 @@
|
|||
* Javier Montalvo Orus (Symbian) - initial API and implementation
|
||||
* Javier Montalvo Orus (Symbian) - added transport key
|
||||
* Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE
|
||||
* Javier Montalvo Orus (Symbian) - [191207] DNS-SD adds duplicated transport attribute when discovery is refreshed
|
||||
********************************************************************************/
|
||||
|
||||
package org.eclipse.tm.internal.discovery.protocol.dnssd;
|
||||
|
@ -122,6 +123,8 @@ public class DNSSDProtocol implements IProtocol {
|
|||
private final Pattern srvPattern = Pattern.compile("^(.+)\\._(.+)._(.+)\\.local."); //$NON-NLS-1$
|
||||
private final Pattern ptrPattern = Pattern.compile("^_(.+)._.+\\.local."); //$NON-NLS-1$
|
||||
|
||||
private final String TRANSPORT_KEY = "transport"; //$NON-NLS-1$
|
||||
|
||||
private Resource resource = null;
|
||||
private ITransport transport = null;
|
||||
private String query = null;
|
||||
|
@ -609,13 +612,33 @@ public class DNSSDProtocol implements IProtocol {
|
|||
serviceType.getService().add(service);
|
||||
}
|
||||
|
||||
//add discovered transport
|
||||
//add or update discovered transport if available in response
|
||||
if(serviceTransport != null)
|
||||
{
|
||||
Pair transportPair = ModelFactory.eINSTANCE.createPair();
|
||||
transportPair.setKey("transport"); //$NON-NLS-1$
|
||||
transportPair.setValue(serviceTransport);
|
||||
service.getPair().add(transportPair);
|
||||
|
||||
Iterator pairIterator = service.getPair().iterator();
|
||||
found = false;
|
||||
while (pairIterator.hasNext()) {
|
||||
Pair aPair = (Pair) pairIterator.next();
|
||||
if (aPair != null) {
|
||||
if (TRANSPORT_KEY.equals(aPair.getKey())) {
|
||||
|
||||
//update transport value
|
||||
aPair.setValue(serviceTransport);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
Pair transportPair = ModelFactory.eINSTANCE.createPair();
|
||||
transportPair.setKey(TRANSPORT_KEY);
|
||||
transportPair.setValue(serviceTransport);
|
||||
service.getPair().add(transportPair);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//process "key=value" pairs
|
||||
|
|
Loading…
Add table
Reference in a new issue