From 0715e69cd7f0ca0beb68a61195034e7c60e483bd Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Sat, 25 Jan 2020 18:41:44 +0100 Subject: [PATCH] Revised LoginCredentialProcessor and worked on MessageProcessor --- .../java/envoy/server/ConnectionManager.java | 2 +- .../processors/LoginCredentialProcessor.java | 44 ++++++++++++------- .../server/processors/MessageProcessor.java | 8 ---- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/main/java/envoy/server/ConnectionManager.java b/src/main/java/envoy/server/ConnectionManager.java index 0ae8fcc..202334f 100644 --- a/src/main/java/envoy/server/ConnectionManager.java +++ b/src/main/java/envoy/server/ConnectionManager.java @@ -60,7 +60,7 @@ public class ConnectionManager implements ISocketIdListener { */ public void registerUser(long userId, long socketId) { sockets.put(userId, socketId); - pendingSockets.remove(userId); + pendingSockets.remove(socketId); } /** diff --git a/src/main/java/envoy/server/processors/LoginCredentialProcessor.java b/src/main/java/envoy/server/processors/LoginCredentialProcessor.java index 71a55dc..376989a 100644 --- a/src/main/java/envoy/server/processors/LoginCredentialProcessor.java +++ b/src/main/java/envoy/server/processors/LoginCredentialProcessor.java @@ -1,6 +1,7 @@ package envoy.server.processors; import java.io.IOException; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -37,24 +38,14 @@ public class LoginCredentialProcessor implements ObjectProcessor users = PersistenceManager.getPersistenceManager() @@ -79,4 +70,25 @@ public class LoginCredentialProcessor implements ObjectProcessor { System.err.println("Recipient online. Failed to send message" + message.getId()); e.printStackTrace(); } - try {// sender receives confirmation that the server received the message - writeProxy.write(connectionManager.getSocketId(message.getSenderId()), - new MessageStatusChangeEvent(message.getId(), message.getStatus(), new Date())); - } catch (IOException e) { - e.printStackTrace(); - } PersistenceManager.getPersistenceManager().addMessage(new envoy.server.data.Message(message)); } }