bug in server socket registration
This commit is contained in:
parent
d254d8be0c
commit
28ee16b572
1 changed files with 7 additions and 4 deletions
|
@ -39,6 +39,7 @@ function emit(socket, type, data){
|
||||||
};
|
};
|
||||||
|
|
||||||
function broadcast(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);
|
this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data);
|
||||||
if(!data)
|
if(!data)
|
||||||
data=false;
|
data=false;
|
||||||
|
@ -186,8 +187,6 @@ function init(path,config,log,port){
|
||||||
var e=JSON.parse(data.shift());
|
var e=JSON.parse(data.shift());
|
||||||
server.log('received event of : '.debug,e.type.data,e.data);
|
server.log('received event of : '.debug,e.type.data,e.data);
|
||||||
|
|
||||||
server.sockets.push(sock);
|
|
||||||
|
|
||||||
server.trigger(
|
server.trigger(
|
||||||
e.type,
|
e.type,
|
||||||
e.data,
|
e.data,
|
||||||
|
@ -308,7 +307,8 @@ function init(path,config,log,port){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
server.log('Socket disconnected'.notice);
|
server.log(socket.id, 'socket disconnected'.notice);
|
||||||
|
var deadSocket=socket.id;
|
||||||
|
|
||||||
if(socket)
|
if(socket)
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
@ -316,7 +316,10 @@ function init(path,config,log,port){
|
||||||
server.sockets.splice(i,1);
|
server.sockets.splice(i,1);
|
||||||
|
|
||||||
server.trigger(
|
server.trigger(
|
||||||
'socket.disconnected'
|
'socket.disconnected',
|
||||||
|
{
|
||||||
|
id:deadSocket
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue