Skip to content

Instantly share code, notes, and snippets.

@3rd-Eden
Created October 12, 2010 17:56
Show Gist options
  • Save 3rd-Eden/622612 to your computer and use it in GitHub Desktop.
Save 3rd-Eden/622612 to your computer and use it in GitHub Desktop.
Listener.prototype.cleanup = function(){
var k = Object.keys(this.clients),
i = k.length,
clientCount = i,
readyStates = {},
requestStates = {};
while( i-- ){
if(this.clients[k[i]]){
if( this.clients[k[i]].connection && !!this.clients[k[i]].connection.readyState ){
readyStates[ this.clients[k[i]].connection.readyState ] = readyStates[ this.clients[k[i]].connection.readyState ] ? readyStates[ this.clients[k[i]].connection.readyState ] + 1 : 1;
}
if( !!this.clients[k[i]].request && !!this.clients[k[i]].request.socket && !!this.clients[k[i]].request.socket.readyState ){
requestStates[ this.clients[k[i]].request.socket.readyState ] = requestStates[ this.clients[k[i]].request.socket.readyState ] ? requestStates[ this.clients[k[i]].request.socket.readyState ] + 1 : 1;
}
}
}
console.log("\n\n");
console.dir( readyStates );
console.log("\n\n");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment