alexey-chebotar/ruby-ldap — pull request #22 by dacamp (2013-08-23 10:57:27+00:00)
Title: LDAP_OPT_NETWORK_TIMEOUT for openLDAP

Thanks for actively maintaining this, it's been very handy.

I've been using it in a rails application and noticed that while connecting to a remote server, the application would get hung up for 30 seconds or so if the remote server was unreachable. Even Timeout wouldn't break the pause.

On systems using openLDAP, you can set a max network timeout LDAP_OPT_NETWORK_TIMEOUT, and I've tried to add that as best I could. If you think it'd be helpful, please review what I've got and let me know if I can answer any questions.

I have tested it with both 1.8 and 1.9, which are the two mentioned in your README. I can test 2.0.0 if you'd like.

I had to implicitly declare rb_time_interval in rbldap.h for ruby 1.8. I'm not exactly sure why, but if you have a more elegant solution, I can update my pull or you can just make the changes as needed.

Thanks!