|
androndo - I looked into this. This code was first introduced in the MongoDB server repository here:
https://github.com/mongodb/mongo/commit/61b8f72884dc6fee89b91a30021f41e50cb9de0e
That was before we split the C++ driver out of the MongoDB sources, and, as far as I can tell, that line has never changed since it was first written, in either body of code. I will try to do some research into why it works that way, however it was a long time ago. Also, please note that this sort of function is inherently racy: even though this function returns 'true', the connection could still go bad between when your program reads the result of calling isStillConnected, and when you actually try to use the connection. So, I can't recommend relying on this as a way of trying to be aware of connection state to work around other issues. Regarding the other issue you filed, I'll reply in that ticket.
|