File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1265,6 +1265,11 @@ mongoc_uri_get_local_threshold_option (const mongoc_uri_t *uri)
1265
1265
BSON_ITER_HOLDS_INT32 (& iter )) {
1266
1266
1267
1267
retval = bson_iter_int32 (& iter );
1268
+
1269
+ if (retval < 0 ) {
1270
+ MONGOC_WARNING ("Invalid localThresholdMS: %d" , retval );
1271
+ retval = MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS ;
1272
+ }
1268
1273
}
1269
1274
1270
1275
return retval ;
Original file line number Diff line number Diff line change @@ -1089,6 +1089,19 @@ test_mongoc_uri_local_threshold_ms (void)
1089
1089
ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = , 99 );
1090
1090
1091
1091
mongoc_uri_destroy (uri );
1092
+
1093
+
1094
+ uri = mongoc_uri_new (
1095
+ "mongodb://localhost/?" MONGOC_URI_LOCALTHRESHOLDMS "=-1" );
1096
+
1097
+ /* localthresholdms is invalid, return the default */
1098
+ capture_logs (true);
1099
+ ASSERT_CMPINT (mongoc_uri_get_local_threshold_option (uri ), = = ,
1100
+ MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS );
1101
+ ASSERT_CAPTURED_LOG ("mongoc_uri_get_local_threshold_option" ,
1102
+ MONGOC_LOG_LEVEL_WARNING , "Invalid localThresholdMS: -1" );
1103
+
1104
+ mongoc_uri_destroy (uri );
1092
1105
}
1093
1106
1094
1107
void
You can’t perform that action at this time.
0 commit comments