aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-11 14:26:02 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-11 14:26:02 +0200
commitbeb82310dad23d1337b6969638e805bb75f6a376 (patch)
treea3f0123c482836baa0f320e9f6f9ac8912efeb2a
parent0193e0291cff98843ce04aae3de05aa020e8d71d (diff)
made jingle connection array thread safe
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java8
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java1
2 files changed, 4 insertions, 5 deletions
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
index d4af624a3..f01d7fa9b 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
@@ -2,12 +2,11 @@ package eu.siacs.conversations.xmpp.jingle;
import java.math.BigInteger;
import java.security.SecureRandom;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-
+import java.util.concurrent.CopyOnWriteArrayList;
+import android.annotation.SuppressLint;
import android.util.Log;
-
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.services.XmppConnectionService;
@@ -20,10 +19,11 @@ public class JingleConnectionManager {
private XmppConnectionService xmppConnectionService;
- private List<JingleConnection> connections = new ArrayList<JingleConnection>();
+ private List<JingleConnection> connections = new CopyOnWriteArrayList<JingleConnection>();
private HashMap<String, JingleCandidate> primaryCandidates = new HashMap<String, JingleCandidate>();
+ @SuppressLint("TrulyRandom")
private SecureRandom random = new SecureRandom();
public JingleConnectionManager(XmppConnectionService service) {
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
index f9de6a6a1..d2c84325c 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
@@ -5,7 +5,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
-import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;