added functionality to handle all server errors and added example in TCP basic world server. fixes #56
This commit is contained in:
parent
bbb9ed0369
commit
e8bc96b6f4
2 changed files with 22 additions and 0 deletions
|
@ -33,4 +33,11 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.on(
|
||||
'error',
|
||||
function(err){
|
||||
ipc.log('Got an ERROR!'.warn,err)
|
||||
}
|
||||
)
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -138,6 +138,7 @@ function init(path,config,log,port){
|
|||
socket.address,
|
||||
function(err, bytes) {
|
||||
if(err){
|
||||
server.log('error writing data to socket'.warn,err);
|
||||
server.trigger(
|
||||
'error',
|
||||
function(err){
|
||||
|
@ -161,6 +162,18 @@ function init(path,config,log,port){
|
|||
);
|
||||
}
|
||||
|
||||
server.server.on(
|
||||
'error',
|
||||
function(err){
|
||||
server.log('server error'.warn,err);
|
||||
|
||||
server.trigger(
|
||||
'error',
|
||||
err
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
function serverCreated(socket) {
|
||||
server.sockets.push(socket);
|
||||
|
||||
|
@ -181,6 +194,8 @@ function init(path,config,log,port){
|
|||
socket.on(
|
||||
'error',
|
||||
function(err){
|
||||
server.log('server socket error'.warn,err);
|
||||
|
||||
server.trigger('error',err);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue