From 33772fafb8f4b803fba97f82b14214a8c3bec780 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 20 Feb 2016 17:16:15 +0100 Subject: [PATCH] don't stop after an error https://github.com/nodejs/node/issues/3045#issuecomment-142955116 #367 --- package.json | 2 +- src/client.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 662b8be..cecd9d4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "buffer-equal": "1.0.0", "minecraft-data": "^1.0.3", "prismarine-nbt": "0.2.1", - "protodef": "^1.0.0", + "protodef": "^1.0.1", "readable-stream": "^2.0.5", "ursa-purejs": "0.0.3", "uuid-1345": "^0.99.6", diff --git a/src/client.js b/src/client.js index 51b22d2..b08486f 100644 --- a/src/client.js +++ b/src/client.js @@ -58,6 +58,10 @@ class Client extends EventEmitter const serializerDirection = !this.isServer ? 'toServer' : 'toClient'; e.field = [this.protocolState, serializerDirection].concat(parts).join("."); e.message = `Serialization error for ${e.field} : ${e.message}`; + if(!this.compressor) + this.serializer.pipe(this.framer); + else + this.serializer.pipe(this.compressor); this.emit('error',e); }); @@ -68,6 +72,10 @@ class Client extends EventEmitter const deserializerDirection = this.isServer ? 'toServer' : 'toClient'; e.field = [this.protocolState, deserializerDirection].concat(parts).join("."); e.message = `Deserialization error for ${e.field} : ${e.message}`; + if(!this.compressor) + this.splitter.pipe(this.deserializer); + else + this.decompressor.pipe(this.deserializer); this.emit('error',e); });