Skip to content

Commit f0ab110

Browse files
committed
conditionally kill connection when a CSOT error occurs
1 parent f9a9f77 commit f0ab110

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/cmap/connection.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
714714
let err = error;
715715
if (TimeoutError.is(error)) {
716716
err = new MongoOperationTimeoutError('Timed out at socket write');
717+
this.cleanup(err);
717718
}
718-
this.cleanup(error);
719719
throw err;
720720
}
721721
}
@@ -756,7 +756,6 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
756756
this.onError(error);
757757
throw error;
758758
}
759-
this.cleanup(err);
760759
throw err;
761760
} finally {
762761
this.dataEvents = null;

0 commit comments

Comments
 (0)