move reconnect logic from Request.callback to Request.request

This commit is contained in:
Ivan Tivonenko
2015-09-09 21:00:03 +03:00
parent c57cef4a21
commit 77068667e4
3 changed files with 33 additions and 16 deletions

View File

@@ -672,6 +672,7 @@ Server.prototype._handleResponse = function(message) {
const responseEvent = 'response_' + command;
request.emit('success', result);
request.emit('response', result);
[this, this._remote].forEach(function(emitter) {
emitter.emit(responseEvent, result, request, message);
@@ -686,6 +687,7 @@ Server.prototype._handleResponse = function(message) {
error_message: 'Remote reported an error.',
remote: message
});
request.emit('response');
}
};