Blocknotify listener errors are logged and don't crash the system.

This commit is contained in:
Matt 2014-04-02 16:17:57 -06:00
parent db99f49ec0
commit abcf97d34f

View File

@ -17,8 +17,10 @@ var listener = module.exports = function listener(options){
} }
var blockNotifyServer = net.createServer(function(c) { var blockNotifyServer = net.createServer(function(c) {
emitLog('Block listener has incoming connection'); emitLog('Block listener has incoming connection');
var data = ''; var data = '';
try {
c.on('data', function (d) { c.on('data', function (d) {
emitLog('Block listener received blocknotify data'); emitLog('Block listener received blocknotify data');
data += d; data += d;
@ -38,6 +40,11 @@ var listener = module.exports = function listener(options){
emitLog('Block listener received notification with incorrect password'); emitLog('Block listener received notification with incorrect password');
}); });
}
catch(e){
emitLog('Block listener failed to parse message ' + data);
}
}); });
blockNotifyServer.listen(options.port, function() { blockNotifyServer.listen(options.port, function() {
emitLog('Block notify listener server started on port ' + options.port) emitLog('Block notify listener server started on port ' + options.port)