Commit 3ad85083 authored by Yusuke Iwaki's avatar Yusuke Iwaki

fix 2 or more websockets illegally connected

parent 66a68396
...@@ -86,7 +86,9 @@ public class RocketChatService extends Service { ...@@ -86,7 +86,9 @@ public class RocketChatService extends Service {
for (ServerConfig config : configList) { for (ServerConfig config : configList) {
findOrCreateWebSocketThread(config).onSuccess(task -> { findOrCreateWebSocketThread(config).onSuccess(task -> {
RocketChatWebSocketThread thread = task.getResult(); RocketChatWebSocketThread thread = task.getResult();
thread.syncStateWith(config); if (thread != null) {
thread.syncStateWith(config);
}
return null; return null;
}); });
} }
...@@ -97,6 +99,7 @@ public class RocketChatService extends Service { ...@@ -97,6 +99,7 @@ public class RocketChatService extends Service {
if (webSocketThreads.containsKey(serverConfigId)) { if (webSocketThreads.containsKey(serverConfigId)) {
return Task.forResult(webSocketThreads.get(serverConfigId)); return Task.forResult(webSocketThreads.get(serverConfigId));
} else { } else {
webSocketThreads.put(serverConfigId, null);
return RocketChatWebSocketThread.getStarted(getApplicationContext(), config) return RocketChatWebSocketThread.getStarted(getApplicationContext(), config)
.onSuccessTask(task -> { .onSuccessTask(task -> {
webSocketThreads.put(serverConfigId, task.getResult()); webSocketThreads.put(serverConfigId, task.getResult());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment