1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-13 03:55:22 +02:00

[191207] DNS-SD adds duplicated transport attribute when discovery is refreshed

This commit is contained in:
Javier Montalvo Orus 2007-06-12 10:34:01 +00:00
parent 2781ca39f7
commit ac4fed2b3c

View file

@ -8,6 +8,7 @@
* Javier Montalvo Orus (Symbian) - initial API and implementation * Javier Montalvo Orus (Symbian) - initial API and implementation
* Javier Montalvo Orus (Symbian) - added transport key * Javier Montalvo Orus (Symbian) - added transport key
* Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE * 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; 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 srvPattern = Pattern.compile("^(.+)\\._(.+)._(.+)\\.local."); //$NON-NLS-1$
private final Pattern ptrPattern = 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 Resource resource = null;
private ITransport transport = null; private ITransport transport = null;
private String query = null; private String query = null;
@ -609,13 +612,33 @@ public class DNSSDProtocol implements IProtocol {
serviceType.getService().add(service); serviceType.getService().add(service);
} }
//add discovered transport //add or update discovered transport if available in response
if(serviceTransport != null) if(serviceTransport != null)
{ {
Pair transportPair = ModelFactory.eINSTANCE.createPair();
transportPair.setKey("transport"); //$NON-NLS-1$ Iterator pairIterator = service.getPair().iterator();
transportPair.setValue(serviceTransport); found = false;
service.getPair().add(transportPair); 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 //process "key=value" pairs