diff --git a/server.js b/server.js index a30a5ef..7f2bdb2 100644 --- a/server.js +++ b/server.js @@ -14,10 +14,10 @@ var occupancy = [0, 0, 0, 0]; var suffixes = [11, 12, 13, 14]; var clients = {}; -function allocateClient(req) { +function allocateClient(msg) { var slot; - if (req.pref_ip) { - slot = suffixes.indexOf(req.pref_ip); + if (msg.pref_ip) { + slot = suffixes.indexOf(msg.pref_ip); if (slot >= 0 && !occupancy[slot]) { occupancy[slot] = 1; return slot; @@ -81,7 +81,7 @@ function registerUser(conn, req, msg) { } // Allocate User - var slot = allocateClient(req); + var slot = allocateClient(msg); var realip = req.socket.remoteAddress; if (slot < 0) { console.log('Dropping ' + realip + ' due to no party vacancy');