mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Reworked DiscoverInfo and DiscoverItems
- Change the return type from Iterator to List - Remove the synchronized blocks
This commit is contained in:
parent
2619a63c21
commit
c4f86762cb
13 changed files with 102 additions and 151 deletions
|
@ -21,7 +21,6 @@ import java.net.InetAddress;
|
|||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smack.SmackException.NoResponseException;
|
||||
|
@ -435,9 +434,7 @@ public class RTPBridge extends IQ {
|
|||
// }
|
||||
|
||||
DiscoverInfo discoInfo = disco.discoverInfo(connection.getServiceName());
|
||||
Iterator<DiscoverInfo.Identity> iter = discoInfo.getIdentities();
|
||||
while (iter.hasNext()) {
|
||||
DiscoverInfo.Identity identity = iter.next();
|
||||
for (DiscoverInfo.Identity identity : discoInfo.getIdentities()) {
|
||||
if ((identity.getName() != null) && (identity.getName().startsWith("rtpbridge"))) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.jivesoftware.smackx.jingle.nat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -222,14 +221,10 @@ public class STUN extends IQ {
|
|||
ServiceDiscoveryManager disco = ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
DiscoverItems items = disco.discoverItems(connection.getServiceName());
|
||||
|
||||
Iterator<DiscoverItems.Item> iter = items.getItems();
|
||||
while (iter.hasNext()) {
|
||||
DiscoverItems.Item item = iter.next();
|
||||
for (DiscoverItems.Item item : items.getItems()) {
|
||||
DiscoverInfo info = disco.discoverInfo(item.getEntityID());
|
||||
|
||||
Iterator<DiscoverInfo.Identity> iter2 = info.getIdentities();
|
||||
while (iter2.hasNext()) {
|
||||
DiscoverInfo.Identity identity = iter2.next();
|
||||
for (DiscoverInfo.Identity identity : info.getIdentities()) {
|
||||
if (identity.getCategory().equals("proxy") && identity.getType().equals("stun"))
|
||||
if (info.containsFeature(NAMESPACE))
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue