Skip to content
This repository has been archived by the owner on Dec 29, 2019. It is now read-only.

Commit

Permalink
Fixed weird conditions for DNS responders.
Browse files Browse the repository at this point in the history
  • Loading branch information
neatorobito committed Nov 1, 2015
1 parent 4711d90 commit 3050a2d
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/main/java/com/peak/salut/Salut.java
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,19 @@ public void onDnsSdTxtRecordAvailable(String serviceFullDomainName, Map<String,
if(record.containsValue(thisDevice.serviceName))
{
SalutDevice foundDevice = new SalutDevice(device, record);

foundDevices.add(foundDevice);
if(!firstDeviceAlreadyFound && !callContinously)

if(callContinously)
{
onDeviceFound.call();
firstDeviceAlreadyFound = true;
}
else if(callContinously)
else
{
onDeviceFound.call();
if(!firstDeviceAlreadyFound)
{
onDeviceFound.call();
firstDeviceAlreadyFound = true;
}
}
}
}
Expand Down Expand Up @@ -741,14 +744,17 @@ public void onDnsSdTxtRecordAvailable(String serviceFullDomainName, Map<String,
SalutDevice foundDevice = new SalutDevice(device, record);

foundDevices.add(foundDevice);
if(!firstDeviceAlreadyFound && !callContinously)
if(callContinously)
{
onDeviceFound.call(foundDevice);
firstDeviceAlreadyFound = true;
}
else if(callContinously)
else
{
onDeviceFound.call(foundDevice);
if(!firstDeviceAlreadyFound)
{
onDeviceFound.call(foundDevice);
firstDeviceAlreadyFound = true;
}
}
}
}
Expand Down Expand Up @@ -900,6 +906,7 @@ public void onSuccess() {
public void stopServiceDiscovery(boolean shouldUnregister)
{
isDiscovering = false;
firstDeviceAlreadyFound = false;

if(isConnectedToAnotherDevice)
disconnectFromDevice();
Expand Down

0 comments on commit 3050a2d

Please sign in to comment.