Skip to content

Commit d46125d

Browse files
committed
Update bouncer.js
Fixed this error: TypeError: Cannot read property 'write' of undefined at TLSSocket.<anonymous> (/home/debian/node/jbnc/bouncer.js:312:42) at TLSSocket.emit (events.js:315:20) at addChunk (_stream_readable.js:295:12) at readableAddChunk (_stream_readable.js:271:9) at TLSSocket.Readable.push (_stream_readable.js:212:10) at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23) # Serious problem (uncaughtException) - this should not happen but the JBNC is still running. TypeError: Cannot read property 'write' of undefined
1 parent 8d10cd2 commit d46125d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bouncer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ process.on('SIGHUP',function() {
5151
BOUNCER_ADMIN=config.bouncerAdmin?config.bouncerAdmin:'';
5252
});
5353

54-
// Prevent BNC from crashing for all other users when an error is caused by a user (with log error)
54+
// Prevent BNC from crashing for all other users when an error is caused by a user (with log error and time)
5555
process.on('uncaughtException', (err, origin) => {
56-
console.error(`# Serious problem (${origin}) - this should not happen but the JBNC is still running. ${err.stack}`);
56+
console.error(`${parseInt(Number(new Date()) / 1000)} # Serious problem (${origin}) - this should not happen but the JBNC is still running. ${err.stack}`);
5757
});
5858

5959

@@ -308,7 +308,7 @@ server = doServer(tlsOptions,function(socket) {
308308
if(this.lastping == command[1]) {
309309
this.lastping='';
310310
}
311-
else {
311+
else if(this.hash && connections[this.hash]) {
312312
connections[this.hash].write("PONG "+command[1]+"\n");
313313
}
314314
}

0 commit comments

Comments
 (0)