mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
JS: Fix a leak with requests.
This commit is contained in:
committed by
Stefan Thomas
parent
957513c14c
commit
007cd46621
@@ -19,7 +19,7 @@ var Server = function (remote, cfg)
|
|||||||
this._id = 0;
|
this._id = 0;
|
||||||
this._retry = 0;
|
this._retry = 0;
|
||||||
|
|
||||||
this._requests = [];
|
this._requests = {};
|
||||||
|
|
||||||
this.on('message', this._handle_message.bind(this));
|
this.on('message', this._handle_message.bind(this));
|
||||||
this.on('response_subscribe', this._handle_response_subscribe.bind(this));
|
this.on('response_subscribe', this._handle_response_subscribe.bind(this));
|
||||||
@@ -208,6 +208,8 @@ Server.prototype._handle_message = function (json) {
|
|||||||
// A response to a request.
|
// A response to a request.
|
||||||
var request = self._requests[message.id];
|
var request = self._requests[message.id];
|
||||||
|
|
||||||
|
delete self._requests[message.id];
|
||||||
|
|
||||||
if (!request) {
|
if (!request) {
|
||||||
if (self._remote.trace) utils.logObject("server: UNEXPECTED: %s", message);
|
if (self._remote.trace) utils.logObject("server: UNEXPECTED: %s", message);
|
||||||
} else if ('success' === message.status) {
|
} else if ('success' === message.status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user