From 939f983376a554ce449d17b9559355304fa17458 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio <thefoips@gmail.com> Date: Tue, 3 Feb 2015 07:44:52 +0000 Subject: [PATCH] Refuse multiple connections from the same IP --- server.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.js b/server.js index 34e79a9..9f742d5 100644 --- a/server.js +++ b/server.js @@ -36,6 +36,15 @@ eurecaServer.onConnect(function(conn) { // Grab the client proxy to call functions easily var remote = eurecaServer.getClient(conn.id); + // Refuse multiple connections from the same IP + for (var c in clients) { + if ( clients[c].ip === conn.ip ) + { + console.log("Refusing additional connection from ",conn.ip); + return; + } + } + // Handshake with the client sending it it's new ID remote.handshake(conn.id); @@ -59,6 +68,7 @@ eurecaServer.onConnect(function(conn) { clients[conn.id] = { id: conn.id, remote: remote, + ip: conn.ip, } });