A MongoClient calls disconnect() to reset its connection pool (and other state), whenever it loses its connection to MongoDB. MongoReplicaSetClient calls disconnect() to resets its connection pools for all replica set members. Users might also call disconnect() directly, on either client class.
If threads are waiting for sockets from the connection pool(s) they must be unblocked by disconnect() so they can attempt to open new sockets. Currently they remain blocked on the max_pool_size semaphore. They'll be awakened the next time a socket is checked in.
If the thread that calls disconnect(), then does an operation, it will open a new socket, check it in, and unblock the waiters. But if it doesn't, and all other threads are already blocked, the application deadlocks.