mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +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) - 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,15 +612,35 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
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();
|
Pair transportPair = ModelFactory.eINSTANCE.createPair();
|
||||||
transportPair.setKey("transport"); //$NON-NLS-1$
|
transportPair.setKey(TRANSPORT_KEY);
|
||||||
transportPair.setValue(serviceTransport);
|
transportPair.setValue(serviceTransport);
|
||||||
service.getPair().add(transportPair);
|
service.getPair().add(transportPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//process "key=value" pairs
|
//process "key=value" pairs
|
||||||
|
|
||||||
StringBuffer dataBuffer = new StringBuffer();
|
StringBuffer dataBuffer = new StringBuffer();
|
||||||
|
|
Loading…
Add table
Reference in a new issue