aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-07-30 19:45:04 -0700
committerAdam Soltys <[email protected]>2020-07-30 19:45:04 -0700
commit51405858756e107304a908898d2ac6ea5a43f121 (patch)
treeb27c601e9dc2fc8b5c0c08122c6f0b0504a9a693
parent68556f9272a66c0cf4d9deacc340e59da045fdd1 (diff)
downloadcoinos-server-51405858756e107304a908898d2ac6ea5a43f121.tar.gz
coinos-server-51405858756e107304a908898d2ac6ea5a43f121.zip
logout the earliest socket not the latest
-rw-r--r--lib/sockets.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sockets.js b/lib/sockets.js
index 87317a16..514d701a 100644
--- a/lib/sockets.js
+++ b/lib/sockets.js
@@ -56,8 +56,8 @@ wss.on("connection", function (ws, req) {
if (!sockets[username]) sockets[username] = {};
const existing = Object.keys(sockets[username]);
if (existing.length > 5) {
- l.warn("too many sockets, logging out", existing[0]);
- sockets[username][existing[0]].send(
+ l.warn("too many sockets, logging out", existing[5]);
+ sockets[username][existing[5]].send(
JSON.stringify({ type: "login", data: false })
);
}