Retry a stream we cannot read, and cover the framer reset on attach
A framing or codec error tears the link down rather than the session, so the loop retries it on a fresh socket with a fresh framer — which is what a desynced stream needs. Removing that reset failed nothing before; the reconnect test now leaves half a PDU on the dying link, and does. `disconnected` counts failed links rather than outages, which the README now says, and the transport wires its socket as it is built.
This commit is contained in:
+1
-3
@@ -136,7 +136,6 @@ export class Session extends EventEmitter<SessionEvents> {
|
||||
this.transport = this.transportFor(options.sock);
|
||||
this.window = new SendWindow(options.maxOutstanding ?? defaults.maxOutstanding);
|
||||
|
||||
this.attach(options.sock);
|
||||
this.resetTimers();
|
||||
}
|
||||
|
||||
@@ -263,7 +262,7 @@ export class Session extends EventEmitter<SessionEvents> {
|
||||
onPdu: pduObj => { this.dispatch(pduObj); },
|
||||
onUnreadable: err => {
|
||||
this.emit('sessionError', err);
|
||||
this.end();
|
||||
this.teardown();
|
||||
},
|
||||
}, sock);
|
||||
}
|
||||
@@ -375,7 +374,6 @@ export class Session extends EventEmitter<SessionEvents> {
|
||||
this.emitClose();
|
||||
}
|
||||
|
||||
/** A session torn down by a drop the loop was retrying reaches here with nothing left to tear down. */
|
||||
private emitClose(): void {
|
||||
if (this.ended) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user