File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
MongoDB.Driver/Communication/Proxies Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -225,16 +225,17 @@ private void Discover(TimeSpan timeout)
225
225
}
226
226
227
227
MongoServerInstance instance = null ;
228
- var timeoutAt = DateTime . UtcNow ;
229
- while ( ( instance = connectionQueue . Dequeue ( timeout ) ) != null )
228
+ var timeRemaining = timeout ;
229
+ var timeoutAt = DateTime . UtcNow + timeout ;
230
+ while ( ( instance = connectionQueue . Dequeue ( timeRemaining ) ) != null )
230
231
{
231
232
if ( instance . ConnectException == null )
232
233
{
233
234
CreateActualProxy ( instance , connectionQueue ) ;
234
235
return ;
235
236
}
236
237
237
- timeout = DateTime . UtcNow - timeoutAt ;
238
+ timeRemaining = timeoutAt - DateTime . UtcNow ;
238
239
}
239
240
240
241
throw new MongoConnectionException ( string . Format ( "Unable to connect in the specified timeframe of '{0}'." , timeout ) ) ;
You can’t perform that action at this time.
0 commit comments