Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte-Hansen committed Sep 29, 2018
2 parents f26fe64 + 1eef06e commit a7bf864
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/main/java/net/explorviz/extension/vr/main/MultiUserMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

import org.java_websocket.WebSocket;
Expand Down Expand Up @@ -57,7 +56,7 @@ public void run2() {
double delta = 0;
long now;
long lastTime = java.lang.System.nanoTime();
long checkedDisconnectTime = java.lang.System.nanoTime();
final long checkedDisconnectTime = java.lang.System.nanoTime();

while (running) {
now = java.lang.System.nanoTime();
Expand All @@ -69,14 +68,13 @@ public void run2() {
delta--;
}

// check if all users are still connected regulary
if ((now - checkedDisconnectTime) / 1000 >= 30000000) {
checkedDisconnectTime = now;
CompletableFuture.runAsync(() -> {
checkForDisconnects();
});

}
// check if all users are still connected regularly
/*
* if ((now - checkedDisconnectTime) / 1000 >= 30000000) { checkedDisconnectTime
* = now; CompletableFuture.runAsync(() -> { checkForDisconnects(); });
*
* }
*/
}
}

Expand Down Expand Up @@ -450,7 +448,6 @@ public void onClose(final WebSocket conn, final int code, final String reason, f

@Override
public void onMessage(final WebSocket conn, final String message) {
// LOGGER.info("Message from client: " + message);
new Thread(() -> {
final JSONArray queue = new JSONArray(message);
for (int i = 0; i < queue.length(); i++) {
Expand All @@ -476,7 +473,6 @@ public void onMessage(final WebSocket conn, final String message) {
broadcastAllBut(JSONmessage, id);
break;
case "receive_connect_request":
LOGGER.info(JSONmessage.toString());
final String name = JSONmessage.getString("name");
user.setUserName(name);
userConnected(id, name);
Expand Down Expand Up @@ -509,12 +505,10 @@ public void onMessage(final WebSocket conn, final String message) {
broadcastAllBut(JSONmessage, id);
break;
case "receive_app_opened":
LOGGER.info(JSONmessage.toString());
updateOpenApp(JSONmessage);
broadcastAllBut(JSONmessage, id);
break;
case "receive_app_closed":
LOGGER.info(JSONmessage.toString());
final Long applicationID = JSONmessage.getLong("id");
apps.remove(applicationID);
broadcastAllBut(JSONmessage, id);
Expand All @@ -523,13 +517,11 @@ public void onMessage(final WebSocket conn, final String message) {
bindingApp(JSONmessage, id);
break;
case "receive_app_released":
LOGGER.info(JSONmessage.toString());
updateOpenApp(JSONmessage);
apps.get(JSONmessage.getLong("id")).setBound(false);
broadcastAllBut(JSONmessage, id);
break;
case "receive_component_update":
LOGGER.info(JSONmessage.toString());
if (JSONmessage.getBoolean("isOpened") && !JSONmessage.getBoolean("isFoundation")) {
apps.get(JSONmessage.getLong("appID")).openComponent(JSONmessage.getLong("componentID"));
}
Expand All @@ -539,12 +531,10 @@ public void onMessage(final WebSocket conn, final String message) {
broadcastAllBut(JSONmessage, id);
break;
case "receive_hightlight_update":
LOGGER.info(JSONmessage.toString());
updateHighlighting(JSONmessage, id);
broadcastAllBut(JSONmessage, id);
break;
case "receive_spectating_update":
LOGGER.info(JSONmessage.toString());
if (JSONmessage.getBoolean("isSpectating"))
users.get(id).setState(State.SPECTATING);
else
Expand Down Expand Up @@ -618,7 +608,6 @@ private void onUserControllers(final JSONObject JSONmessage, final UserModel use
}

private void bindingApp(final JSONObject msg, final Long userID) {
LOGGER.info(msg.toString());
msg.put("userID", userID);
final Long appID = msg.getLong("appID");
final boolean isBound = apps.get(appID).isBound();
Expand Down

0 comments on commit a7bf864

Please sign in to comment.