提交 b9b69ab4 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Improve binary event handling.

上级 c09c7208
...@@ -51,6 +51,9 @@ class Channel extends EventEmitter ...@@ -51,6 +51,9 @@ class Channel extends EventEmitter
// Reset the recvBuffer and exit // Reset the recvBuffer and exit
this._recvBuffer = null; this._recvBuffer = null;
// Just in case
this._lastBinaryNotification = null;
return; return;
} }
} }
...@@ -69,13 +72,16 @@ class Channel extends EventEmitter ...@@ -69,13 +72,16 @@ class Channel extends EventEmitter
// Reset the recvBuffer and exit // Reset the recvBuffer and exit
this._recvBuffer = null; this._recvBuffer = null;
// Just in case
this._lastBinaryNotification = null;
return; return;
} }
// Incomplete netstring // Incomplete netstring
if (nsPayload === -1) if (nsPayload === -1)
{ {
logger.debug('not enought data, waiting for more data'); // logger.debug('not enought data, waiting for more data');
return; return;
} }
...@@ -125,7 +131,6 @@ class Channel extends EventEmitter ...@@ -125,7 +131,6 @@ class Channel extends EventEmitter
// Reset // Reset
this._lastBinaryNotification = null; this._lastBinaryNotification = null;
// Emit // Emit
this.emit(msg.targetId, msg.event, nsPayload); this.emit(msg.targetId, msg.event, nsPayload);
} }
...@@ -136,6 +141,7 @@ class Channel extends EventEmitter ...@@ -136,6 +141,7 @@ class Channel extends EventEmitter
if (!this._recvBuffer.length) if (!this._recvBuffer.length)
{ {
this._recvBuffer = null; this._recvBuffer = null;
return; return;
} }
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论