From: Takaaki Tateishi Date: 2006-05-16T02:07:49+09:00 Subject: Re: Ruby-LDAP and leftover connections Sean Hussey wrote: > I'm using RubyLDAP all over the place in my Rails app. I'm curious, > though, if I'm not specifically unbinding in certain places, are the > connections kept open? The connection is kept open until the connection object is garbage collected, if you call the binding method without a block. However, if you call the binding method with a block, the connection is closed using Conn#unbind at the end of the block. Also, Ruby/LDAP wraps up the native LDAP library as Francis wrote. So behavior of the binding and unbinding methods rely on C API called ldap_bind() and ldap_unbind() defined in RFC1823. In particular, ldap_unbind() is defined to close the connection as follows. 4.3. Closing the connection ldap_unbind() is used to unbind from the directory and close the connection. int ldap_unbind( LDAP *ld ); -- Takaaki Tateishi