mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 06:55:46 +01:00
dont display cluster warning if not running as cluster
This commit is contained in:
@@ -163,34 +163,32 @@ function requireModules() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function authorize(socket, next) {
|
function authorize(socket, callback) {
|
||||||
var handshake = socket.request,
|
var handshake = socket.request,
|
||||||
sessionID;
|
sessionID;
|
||||||
|
|
||||||
if (!handshake) {
|
if (!handshake) {
|
||||||
return next(new Error('[[error:not-authorized]]'));
|
return callback(new Error('[[error:not-authorized]]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
cookieParser(handshake, {}, function(err) {
|
async.waterfall([
|
||||||
if (err) {
|
function(next) {
|
||||||
return next(err);
|
cookieParser(handshake, {}, next);
|
||||||
}
|
},
|
||||||
|
function(next) {
|
||||||
var sessionID = handshake.signedCookies['express.sid'];
|
var sessionID = handshake.signedCookies['express.sid'];
|
||||||
|
console.log(next, sessionID)
|
||||||
db.sessionStore.get(sessionID, function(err, sessionData) {
|
db.sessionStore.get(sessionID, next);
|
||||||
if (err) {
|
},
|
||||||
return next(err);
|
function(sessionData, next) {
|
||||||
}
|
|
||||||
|
|
||||||
if (sessionData && sessionData.passport && sessionData.passport.user) {
|
if (sessionData && sessionData.passport && sessionData.passport.user) {
|
||||||
socket.uid = parseInt(sessionData.passport.user, 10);
|
socket.uid = parseInt(sessionData.passport.user, 10);
|
||||||
} else {
|
} else {
|
||||||
socket.uid = 0;
|
socket.uid = 0;
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
});
|
}
|
||||||
});
|
], callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addRedisAdapter(io) {
|
function addRedisAdapter(io) {
|
||||||
@@ -201,7 +199,7 @@ function addRedisAdapter(io) {
|
|||||||
var sub = redis.connect({return_buffers: true});
|
var sub = redis.connect({return_buffers: true});
|
||||||
|
|
||||||
io.adapter(redisAdapter({pubClient: pub, subClient: sub}));
|
io.adapter(redisAdapter({pubClient: pub, subClient: sub}));
|
||||||
} else {
|
} else if (nconf.get('isCluster') === 'true') {
|
||||||
winston.warn('[socket.io] Clustering detected, you are advised to configure Redis as a websocket store.');
|
winston.warn('[socket.io] Clustering detected, you are advised to configure Redis as a websocket store.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user