aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java')
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
index 924674a7..44af51a3 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
@@ -23,7 +23,7 @@ public class JingleConnectionManager {
private List<JingleConnection> connections = new ArrayList<JingleConnection>(); // make
// concurrent
- private ConcurrentHashMap<String, Element> primaryCandidates = new ConcurrentHashMap<String, Element>();
+ private ConcurrentHashMap<String, JingleCandidate> primaryCandidates = new ConcurrentHashMap<String, JingleCandidate>();
private SecureRandom random = new SecureRandom();
@@ -89,17 +89,12 @@ public class JingleConnectionManager {
if (streamhost != null) {
Log.d("xmppService", "streamhost found "
+ streamhost.toString());
- Element candidate = new Element("candidate");
- candidate.setAttribute("cid",
- nextRandomId());
- candidate.setAttribute("host",
- streamhost.getAttribute("host"));
- candidate.setAttribute("port",
- streamhost.getAttribute("port"));
- candidate.setAttribute("type", "proxy");
- candidate.setAttribute("jid", proxy);
- candidate
- .setAttribute("priority", "655360");
+ JingleCandidate candidate = new JingleCandidate(nextRandomId(),true);
+ candidate.setHost(streamhost.getAttribute("host"));
+ candidate.setPort(Integer.parseInt(streamhost.getAttribute("port")));
+ candidate.setType(JingleCandidate.TYPE_PROXY);
+ candidate.setJid(proxy);
+ candidate.setPriority(655360+65535);
primaryCandidates.put(account.getJid(),
candidate);
listener.onPrimaryCandidateFound(true,
@@ -119,14 +114,6 @@ public class JingleConnectionManager {
this.primaryCandidates.get(account.getJid()));
}
}
-
- public String getPrimaryCandidateId(Account account) {
- if (this.primaryCandidates.containsKey(account.getJid())) {
- return this.primaryCandidates.get(account.getJid()).getAttribute("cid");
- } else {
- return null;
- }
- }
public String nextRandomId() {
return new BigInteger(50, random).toString(32);