On Wed, Feb 22, 2012 at 6:14 PM, Larry Lile <larry.l...@dreamworks.com>wrote:

>
>
> On Wed, Feb 22, 2012 at 5:22 PM, Nick Urbanik <
> nick.urba...@optusnet.com.au> wrote:
>
>> Dear Quanah,
>>
>>
>> On 22/02/12 16:56 -0800, Quanah Gibson-Mount wrote:
>>
>>> --On Thursday, February 23, 2012 11:48 AM +1100 Nick Urbanik <
>>> nick.urba...@optusnet.com.au> wrote:
>>>
>>>> idletimeout  300
>>>>
>>>
>>> This means that you are telling the server to disconnect all persistent
>>> connections after they have been idle for 5 minutes.  Given that you seem
>>> to want your persistent connections to persist, this may not be the wisest
>>> of settings.
>>>
>>
>> Okay, so if I change this to 24 hours, then (as I understand it; am I
>> wrong?) there would be a failure every day.  How do I verify that the
>> connection still works then?
>
>
>
> I've always just trapped for the disconnect at the operation,
> this is also a convenient place to check for referrals.
>
>         # XXX Check for I/O Error on update, reconnect and
>         # XXX retry if possible.  This could be much more sophisticated.
>         $ldap = ldap_open($ldap) and $result = $entry->update($ldap)
>             if $result->code == LDAP_OPERATIONS_ERROR and
>             $result->error =~ m!I/O Error!i;
>
> ldap_open is the same function I use to open an LDAP server
> normally.  When passed an existing LDAP object it will attempt
> to shut it down as cleanly as possible.  I haven't tested this code
> in a while, $result->error =~ m!I/O Error!i may not be correct
> since the latest updates to Net::LDAP.
>
>
> sub ldap_open
> {
>     my $ldap = shift;
>
> ...
>
>     if ($ldap)
>     {
>         warn "\nConnection to ", $ldap->{net_ldap_host},
>             " broken, attempting to reconnect.\n"
>             if $opt_v;
>
>         # XXX Try to close the socket as best we can.
>         close $ldap->{net_ldap_socket};
>
>         foreach my $server (split(/\s+/, $ldap_opt{'host'}))
>         {
>             ($server, my $port) = split(/:/, $server, 2);
>             $port = $ldap_opt{'port'} if ! $port;
>             last if lc $server eq lc $ldap->{net_ldap_host};
>             push @servers, shift @servers;
>         }
>     }
>
> The remainder of the code builds a connection to the LDAP server as usual
> returning it's object to the c


Pardon the interruption there.  =)

The remainder of the code builds a connection to the LDAP server as usual
returning it's object to the caller.

-- 
Larry

Hi Mom! [Just in case my e-mail ever ends up in the Wall Street Journal

Reply via email to