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, } });