Add try-catch around packet decryption

This guards against a service crash resulting from an occasional
packet decryption error.
This commit is contained in:
Jesse Cotton 2018-04-02 21:40:57 -07:00
parent 4d0c98c97a
commit ada0b42123
No known key found for this signature in database
GPG Key ID: 731B5A1B4C1DDCD3

View File

@ -147,10 +147,15 @@ Orvibo.prototype.startServer = function() {
return; return;
} }
if (plugPacket.packetTypeText() === 'pk') { try {
plugPacket.processPacket(ORVIBO_KEY); if (plugPacket.packetTypeText() === 'pk') {
} else { plugPacket.processPacket(ORVIBO_KEY);
plugPacket.processPacket(socketData.encryptionKey); } else {
plugPacket.processPacket(socketData.encryptionKey);
}
} catch(err) {
logger.log('Failed to parse packet: ' + err);
return;
} }
LOG_PACKET && plugPacket.logPacket('Socket -> '); LOG_PACKET && plugPacket.logPacket('Socket -> ');