YUKI Hiroshi
null+****@clear*****
Mon Dec 16 17:34:45 JST 2013
YUKI Hiroshi 2013-12-16 17:34:45 +0900 (Mon, 16 Dec 2013) New Revision: 891560e7cd979af2297361bdf2b1736141640b4f https://github.com/droonga/express-droonga/commit/891560e7cd979af2297361bdf2b1736141640b4f Message: Don't do auto-unsubscribing on client-disconnection if backend-connection is already closed Modified files: lib/adapter/wrapper.js lib/droonga-protocol/connection.js Modified: lib/adapter/wrapper.js (+5 -0) =================================================================== --- lib/adapter/wrapper.js 2013-12-16 17:25:07 +0900 (e40d36a) +++ lib/adapter/wrapper.js 2013-12-16 17:34:45 +0900 (ee2177f) @@ -14,6 +14,11 @@ DroongaProtocolConnectionWrapper.prototype = { (this._routeToSelf = this._connection.getRouteToSelf(this._options)); }, emit: function(event, data, callback) { + if (this._connection.closed) { + console.log('connection is already closed.'); + return; + } + if (callback) { var originalCallback = callback; callback = function(error, response) { Modified: lib/droonga-protocol/connection.js (+2 -0) =================================================================== --- lib/droonga-protocol/connection.js 2013-12-16 17:25:07 +0900 (3975b84) +++ lib/droonga-protocol/connection.js 2013-12-16 17:34:45 +0900 (2f3b518) @@ -43,6 +43,7 @@ function Connection(params) { util.inherits(Connection, EventEmitter); Connection.prototype._init = function() { + this.closed = false; this._callbacks = {}; this._id = Date.now(); this.tag = this._params.tag || DEFAULT_FLUENT_TAG; @@ -187,6 +188,7 @@ Connection.prototype.close = function() { this._receiver.removeAllListeners(); delete this._receiver; } + this.closed = true; }; exports.Connection = Connection; -------------- next part -------------- HTML����������������������������...Download