Hopefully fix an error case
I have no idea why it's possible for sock.handshake to be defined and then undefined
This commit is contained in:
parent
edac89b204
commit
b3c3ee93ce
|
@ -125,6 +125,7 @@ function addTypecheckedFunctions(sock) {
|
||||||
*/
|
*/
|
||||||
function handleConnection(sock) {
|
function handleConnection(sock) {
|
||||||
var ip = sock.handshake.address.address;
|
var ip = sock.handshake.address.address;
|
||||||
|
var sockUser = sock.handshake.user;
|
||||||
if (net.isIPv6(ip)) {
|
if (net.isIPv6(ip)) {
|
||||||
ip = util.expandIPv6(ip);
|
ip = util.expandIPv6(ip);
|
||||||
}
|
}
|
||||||
|
@ -158,10 +159,10 @@ function handleConnection(sock) {
|
||||||
addTypecheckedFunctions(sock);
|
addTypecheckedFunctions(sock);
|
||||||
|
|
||||||
var user = new User(sock);
|
var user = new User(sock);
|
||||||
if (sock.handshake.user) {
|
if (sockUser) {
|
||||||
user.setFlag(Flags.U_REGISTERED);
|
user.setFlag(Flags.U_REGISTERED);
|
||||||
user.clearFlag(Flags.U_READY);
|
user.clearFlag(Flags.U_READY);
|
||||||
user.refreshAccount({ name: sock.handshake.user.name },
|
user.refreshAccount({ name: sockUser.name },
|
||||||
function (err, account) {
|
function (err, account) {
|
||||||
if (err) {
|
if (err) {
|
||||||
user.clearFlag(Flags.U_REGISTERED);
|
user.clearFlag(Flags.U_REGISTERED);
|
||||||
|
|
Loading…
Reference in a new issue