fix(Connection): swallow all the ws errors after connection's closed (#2077)
Since ws is closing asynchronously and can yield errors while closing, we should keep swallowing ws errors after the `ws.close()` method is called.
This commit is contained in:
parent
28f88e8ef9
commit
80078d9526
@ -132,6 +132,8 @@ class Connection extends EventEmitter {
|
|||||||
this._closeCallback = null;
|
this._closeCallback = null;
|
||||||
}
|
}
|
||||||
this._transport.removeAllListeners();
|
this._transport.removeAllListeners();
|
||||||
|
// If transport throws any error at this point of time, we don't care and should swallow it.
|
||||||
|
this._transport.on('error', () => {});
|
||||||
for (const callback of this._callbacks.values())
|
for (const callback of this._callbacks.values())
|
||||||
callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`));
|
callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`));
|
||||||
this._callbacks.clear();
|
this._callbacks.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user