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 {
for (ServerConfig config : configList) {
findOrCreateWebSocketThread(config).onSuccess(task -> {
RocketChatWebSocketThread thread = task.getResult();
thread.syncStateWith(config);
if (thread != null) {
thread.syncStateWith(config);
}
return null;
});
}
......@@ -97,6 +99,7 @@ public class RocketChatService extends Service {
if (webSocketThreads.containsKey(serverConfigId)) {
return Task.forResult(webSocketThreads.get(serverConfigId));
} else {
webSocketThreads.put(serverConfigId, null);
return RocketChatWebSocketThread.getStarted(getApplicationContext(), config)
.onSuccessTask(task -> {
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