@@ -273,43 +273,6 @@ mongoc_topology_destroy (mongoc_topology_t *topology)
273273 bson_free (topology );
274274}
275275
276- /*
277- *--------------------------------------------------------------------------
278- *
279- * _mongoc_topology_run_scanner --
280- *
281- * Not threadsafe, the expectation is that we're either single
282- * threaded or only the background thread runs scans.
283- *
284- * Crank the underlying scanner until we've timed out or finished.
285- *
286- * Returns:
287- * true if there is more work to do, false otherwise
288- *
289- *--------------------------------------------------------------------------
290- */
291- static bool
292- _mongoc_topology_run_scanner (mongoc_topology_t * topology ,
293- int64_t work_msec )
294- {
295- int64_t now ;
296- int64_t expire_at ;
297- bool keep_going = true;
298-
299- now = bson_get_monotonic_time ();
300- expire_at = now + (work_msec * 1000 );
301-
302- /* while there is more work to do and we haven't timed out */
303- while (keep_going && now <= expire_at ) {
304- keep_going = mongoc_topology_scanner_work (topology -> scanner , (expire_at - now ) / 1000 );
305-
306- if (keep_going ) {
307- now = bson_get_monotonic_time ();
308- }
309- }
310-
311- return keep_going ;
312- }
313276
314277/*
315278 *--------------------------------------------------------------------------
@@ -327,8 +290,8 @@ _mongoc_topology_do_blocking_scan (mongoc_topology_t *topology, bson_error_t *er
327290 topology -> connect_timeout_msec ,
328291 true);
329292
330- while ( _mongoc_topology_run_scanner ( topology ,
331- topology -> connect_timeout_msec )) {}
293+ mongoc_topology_scanner_work ( topology -> scanner ,
294+ topology -> connect_timeout_msec );
332295
333296 /* Aggregate all scanner errors, if any */
334297 mongoc_topology_scanner_sum_errors (topology -> scanner , error );
@@ -808,9 +771,8 @@ void * _mongoc_topology_run_background (void *data)
808771
809772 /* scanning locks and unlocks the mutex itself until the scan is done */
810773 mongoc_mutex_unlock (& topology -> mutex );
811-
812- while (_mongoc_topology_run_scanner (topology ,
813- topology -> connect_timeout_msec )) {}
774+ mongoc_topology_scanner_work (topology -> scanner ,
775+ topology -> connect_timeout_msec );
814776
815777 mongoc_mutex_lock (& topology -> mutex );
816778
0 commit comments