Skip to content

Commit

Permalink
fixes #61
Browse files Browse the repository at this point in the history
  • Loading branch information
incompl committed Dec 19, 2013
1 parent c005cff commit 1a6642d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server/cloak/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ module.exports = (function() {
gameLoopInterval = setInterval(function() {
var room;

// Pulse lobby
lobby._pulse();

// Pulse all rooms
_(rooms).forEach(function(room) {
var oldEnoughToPrune = room.members.length < 1 && new Date().getTime() - room._lastEmpty >= config.pruneEmptyRooms;
Expand Down
43 changes: 43 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,49 @@ module.exports = _.extend(suite, {
setTimeout(function() {
client2.run(that.host);
}, 50);
},

pulse: function(test) {
test.expect(20);

var lobbyPulses = 10;
var roomPulses = 10;

function checkIfDone() {
if (lobbyPulses === 0 && roomPulses === 0) {
test.done();
}
}

var server = this.server;
var client = suite.createClient();
server.configure({
port: this.port,
lobby: {
pulse: function() {
lobbyPulses--;
test.ok(true);
checkIfDone();
}
},
room: {
pulse: function() {
roomPulses--;
test.ok(true);
checkIfDone();
}
}
});

client.configure({
serverEvents: {
begin: function() {
server.createRoom();
}
}
});
server.run();
client.run(this.host);
}

});

0 comments on commit 1a6642d

Please sign in to comment.