In the process of fixing CDRIVER-1639 "Rand used to pick Mongo server is not seeded" I changed how the driver randomly chooses a suitable server when built with Microsoft Visual Studio. Before, it used the standard rand() function on every platform. After, it uses rand_s() in MSVC. I didn't realize that the return value of rand_s() is zero on success, rather than the random number.
We use its return value as the index into the list of suitable servers; therefore, we always choose the "first" suitable server, typically the first one in the seed list.
- is related to
-
CDRIVER-1639 Rand used to pick Mongo server is not seeded
- Closed
- related to
-
CDRIVER-2068 mongocxx::pool mongos failover
- Closed