Fix first-boot connection check.
This commit is contained in:
parent
695e70f4c7
commit
4c3535a9d0
10
app.js
10
app.js
@ -89,7 +89,7 @@ server.start(function() {
|
||||
// Track how many people are currently connected.
|
||||
server.io.on('connect', function(client) {
|
||||
// If we haven't sent out at least one round of pings, disconnect them for now.
|
||||
if (Object.keys(networkHistory) < config.servers.length) {
|
||||
if (Object.keys(networkHistory).length < config.servers.length) {
|
||||
client.disconnect();
|
||||
|
||||
return;
|
||||
@ -100,6 +100,10 @@ server.start(function() {
|
||||
|
||||
logger.log('info', 'Accepted connection: %s, total clients: %d', client.request.connection.remoteAddress, connectedClients);
|
||||
|
||||
setTimeout(function() {
|
||||
// Send them our previous data, so they have somewhere to start.
|
||||
client.emit('updateMojangServices', mojang.toMessage());
|
||||
|
||||
// Remap our associative array into just an array.
|
||||
var networkHistoryKeys = Object.keys(networkHistory);
|
||||
|
||||
@ -107,9 +111,7 @@ server.start(function() {
|
||||
for (var i = 0; i < networkHistoryKeys.length; i++) {
|
||||
client.emit('add', [networkHistory[networkHistoryKeys[i]]]);
|
||||
}
|
||||
|
||||
// Send them our previous data, so they have somewhere to start.
|
||||
client.emit('updateMojangServices', mojang.toMessage());
|
||||
}, 1);
|
||||
|
||||
// Attach our listeners.
|
||||
client.on('disconnect', function(client) {
|
||||
|
Loading…
Reference in New Issue
Block a user