bug in server socket registration

This commit is contained in:
brandon 2014-05-07 15:53:20 -07:00
parent d254d8be0c
commit 28ee16b572

View file

@ -39,6 +39,7 @@ function emit(socket, type, data){
};
function broadcast(type,data){
this.log(arguments)
this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data);
if(!data)
data=false;
@ -186,8 +187,6 @@ function init(path,config,log,port){
var e=JSON.parse(data.shift());
server.log('received event of : '.debug,e.type.data,e.data);
server.sockets.push(sock);
server.trigger(
e.type,
e.data,
@ -308,7 +307,8 @@ function init(path,config,log,port){
continue;
}
server.log('Socket disconnected'.notice);
server.log(socket.id, 'socket disconnected'.notice);
var deadSocket=socket.id;
if(socket)
socket.destroy();
@ -316,7 +316,10 @@ function init(path,config,log,port){
server.sockets.splice(i,1);
server.trigger(
'socket.disconnected'
'socket.disconnected',
{
id:deadSocket
}
);
return;