|
@@ -441,20 +441,20 @@ export class Peer extends EventEmitter {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Destroys the Peer and emits an error message.
|
|
|
|
|
|
+ * Emits an error message and destroys the Peer.
|
|
* The Peer is not destroyed if it's in a disconnected state, in which case
|
|
* The Peer is not destroyed if it's in a disconnected state, in which case
|
|
* it retains its disconnected state and its existing connections.
|
|
* it retains its disconnected state and its existing connections.
|
|
*/
|
|
*/
|
|
private _abort(type: PeerErrorType, message): void {
|
|
private _abort(type: PeerErrorType, message): void {
|
|
logger.error("Aborting!");
|
|
logger.error("Aborting!");
|
|
|
|
|
|
|
|
+ this.emitError(type, message);
|
|
|
|
+
|
|
if (!this._lastServerId) {
|
|
if (!this._lastServerId) {
|
|
this.destroy();
|
|
this.destroy();
|
|
} else {
|
|
} else {
|
|
this.disconnect();
|
|
this.disconnect();
|
|
}
|
|
}
|
|
-
|
|
|
|
- this.emitError(type, message);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/** Emits a typed error message. */
|
|
/** Emits a typed error message. */
|