diff --git a/lib/io/ioserver.js b/lib/io/ioserver.js index 09cb12b4..5a2af30e 100644 --- a/lib/io/ioserver.js +++ b/lib/io/ioserver.js @@ -125,6 +125,7 @@ function addTypecheckedFunctions(sock) { */ function handleConnection(sock) { var ip = sock.handshake.address.address; + var sockUser = sock.handshake.user; if (net.isIPv6(ip)) { ip = util.expandIPv6(ip); } @@ -158,10 +159,10 @@ function handleConnection(sock) { addTypecheckedFunctions(sock); var user = new User(sock); - if (sock.handshake.user) { + if (sockUser) { user.setFlag(Flags.U_REGISTERED); user.clearFlag(Flags.U_READY); - user.refreshAccount({ name: sock.handshake.user.name }, + user.refreshAccount({ name: sockUser.name }, function (err, account) { if (err) { user.clearFlag(Flags.U_REGISTERED);