@@ -241,7 +241,10 @@ function resetPoolState(pool) {
241
241
242
242
function connectionFailureHandler ( pool , event , err , conn ) {
243
243
if ( conn ) {
244
- if ( conn . _connectionFailHandled ) return ;
244
+ if ( conn . _connectionFailHandled ) {
245
+ return ;
246
+ }
247
+
245
248
conn . _connectionFailHandled = true ;
246
249
conn . destroy ( ) ;
247
250
@@ -430,7 +433,7 @@ function messageHandler(self) {
430
433
updateSessionFromResponse ( session , document ) ;
431
434
}
432
435
433
- if ( document . $clusterTime ) {
436
+ if ( self . topology && document . $clusterTime ) {
434
437
self . topology . clusterTime = document . $clusterTime ;
435
438
}
436
439
}
@@ -752,11 +755,12 @@ Pool.prototype.reset = function(callback) {
752
755
753
756
resetPoolState ( this ) ;
754
757
755
- // attempt reexecution
756
- process . nextTick ( ( ) => _execute ( this ) ( ) ) ;
757
- if ( typeof callback === 'function' ) {
758
- callback ( null , null ) ;
759
- }
758
+ // create a new connection, this will ultimately trigger execution
759
+ createConnection ( this , ( ) => {
760
+ if ( typeof callback === 'function' ) {
761
+ callback ( null , null ) ;
762
+ }
763
+ } ) ;
760
764
}
761
765
) ;
762
766
} ;
@@ -877,10 +881,6 @@ Pool.prototype.write = function(command, options, cb) {
877
881
// Optional per operation socketTimeout
878
882
operation . socketTimeout = options . socketTimeout ;
879
883
operation . monitoring = options . monitoring ;
880
- // Custom socket Timeout
881
- if ( options . socketTimeout ) {
882
- operation . socketTimeout = options . socketTimeout ;
883
- }
884
884
885
885
// Get the requestId
886
886
operation . requestId = command . requestId ;
0 commit comments