@@ -480,7 +480,7 @@ mongoc_topology_new (const mongoc_uri_t *uri, bool single_threaded)
480
480
* lookup fails, SRV polling will still start when background monitoring
481
481
* starts. */
482
482
topology -> srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000 ;
483
- topology -> srv_polling_rescan_interval_ms = MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS ;
483
+ _mongoc_topology_set_srv_polling_rescan_interval_ms ( topology , MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS ) ;
484
484
485
485
/* a mongodb+srv URI. try SRV lookup, if no error then also try TXT */
486
486
prefixed_hostname = bson_strdup_printf ("_%s._tcp.%s" , mongoc_uri_get_srv_service_name (uri ), srv_hostname );
@@ -518,8 +518,8 @@ mongoc_topology_new (const mongoc_uri_t *uri, bool single_threaded)
518
518
519
519
topology -> srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000 ;
520
520
/* TODO (CDRIVER-4047) use BSON_MIN */
521
- topology -> srv_polling_rescan_interval_ms =
522
- BSON_MAX ( rr_data . min_ttl * 1000 , MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS );
521
+ int64_t new_iv = BSON_MAX ( rr_data . min_ttl * 1000 , MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS );
522
+ _mongoc_topology_set_srv_polling_rescan_interval_ms ( topology , new_iv );
523
523
524
524
topology -> valid = true;
525
525
srv_fail :
@@ -816,7 +816,7 @@ mongoc_topology_rescan_srv (mongoc_topology_t *topology)
816
816
BSON_ASSERT (mongoc_topology_should_rescan_srv (topology ));
817
817
818
818
srv_hostname = mongoc_uri_get_srv_hostname (topology -> uri );
819
- scan_time_ms = topology -> srv_polling_last_scan_ms + topology -> srv_polling_rescan_interval_ms ;
819
+ scan_time_ms = topology -> srv_polling_last_scan_ms + _mongoc_topology_get_srv_polling_rescan_interval_ms ( topology ) ;
820
820
if (bson_get_monotonic_time () / 1000 < scan_time_ms ) {
821
821
/* Query SRV no more frequently than srv_polling_rescan_interval_ms. */
822
822
return ;
@@ -839,14 +839,14 @@ mongoc_topology_rescan_srv (mongoc_topology_t *topology)
839
839
topology -> srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000 ;
840
840
if (!ret ) {
841
841
/* Failed querying, soldier on and try again next time. */
842
- topology -> srv_polling_rescan_interval_ms = td .ptr -> heartbeat_msec ;
842
+ _mongoc_topology_set_srv_polling_rescan_interval_ms ( topology , td .ptr -> heartbeat_msec ) ;
843
843
MONGOC_ERROR ("SRV polling error: %s" , topology -> scanner -> error .message );
844
844
GOTO (done );
845
845
}
846
846
847
847
/* TODO (CDRIVER-4047) use BSON_MIN */
848
- topology -> srv_polling_rescan_interval_ms =
849
- BSON_MAX ( rr_data . min_ttl * 1000 , MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS );
848
+ const int64_t new_iv = BSON_MAX ( rr_data . min_ttl * 1000 , MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS );
849
+ _mongoc_topology_set_srv_polling_rescan_interval_ms ( topology , new_iv );
850
850
851
851
tdmod = mc_tpld_modify_begin (topology );
852
852
if (!mongoc_topology_apply_scanned_srv_hosts (
@@ -861,7 +861,7 @@ mongoc_topology_rescan_srv (mongoc_topology_t *topology)
861
861
* to heartbeatFrequencyMS until at least one verified SRV record is
862
862
* obtained."
863
863
*/
864
- topology -> srv_polling_rescan_interval_ms = td .ptr -> heartbeat_msec ;
864
+ _mongoc_topology_set_srv_polling_rescan_interval_ms ( topology , td .ptr -> heartbeat_msec ) ;
865
865
}
866
866
mc_tpld_modify_commit (tdmod );
867
867
@@ -1889,12 +1889,6 @@ _mongoc_topology_set_rr_resolver (mongoc_topology_t *topology, _mongoc_rr_resolv
1889
1889
topology -> rr_resolver = rr_resolver ;
1890
1890
}
1891
1891
1892
- void
1893
- _mongoc_topology_set_srv_polling_rescan_interval_ms (mongoc_topology_t * topology , int64_t val )
1894
- {
1895
- topology -> srv_polling_rescan_interval_ms = val ;
1896
- }
1897
-
1898
1892
uint32_t
1899
1893
_mongoc_topology_get_connection_pool_generation (const mongoc_topology_description_t * td ,
1900
1894
uint32_t server_id ,
0 commit comments