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)
225225 }
226226
227227 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 )
230231 {
231232 if ( instance . ConnectException == null )
232233 {
233234 CreateActualProxy ( instance , connectionQueue ) ;
234235 return ;
235236 }
236237
237- timeout = DateTime . UtcNow - timeoutAt ;
238+ timeRemaining = timeoutAt - DateTime . UtcNow ;
238239 }
239240
240241 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