"Conrad Hoffmann" <ch@bitfehler.net> writes:
I agree that this would be a far superior solution, and if you want me to I would even try to help you a little.
If you can do the 'baking in' before I get there on friday, that would be most appreciated :) Basically, the current mongo_(sync_)connect() would be renamed to mongo_tcp_(sync)_connect(), and made static. Then mongo_unix_connect() would be introduced, and mongo_connect() made into a wrapper that calls one of the other two, depending on the value of port. The "host" param would also need to be renamed to address. Once that's done, teach the address parser to recognise unix sockets, and return -1 in the port part in that case. I'm not entirely sure what logic should be used to figure out whether an address is a unix socket or not, though. This is probably the hardest part. If all that's done, have a look at mongo_tcp_connect() and mongo_unix_connect() to see if there's any code that can be factored out into a common function. I suspect there will be. And after that: see if it still works.
What I am not sure about is whether MongoDB actually supports replica sets with Unix sockets, but if not I guess it's about time to open a bug report for that ;)
I'm not entirely sure it supports that, but if it does, or ever will, libmongo-client will be prepared :P -- |8]