Changeset 805

Show
Ignore:
Timestamp:
01/13/09 03:23:26 (11 months ago)
Author:
hachi
Message:

Fix reconnects on dead sockets to not be as slow.

Location:
trunk/api/perl
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/api/perl/ChangeLog

    r798 r805  
     1        * Reconnects to a dead connection shouldn't happen every time when the 
     2          connection has never succeded. Apply the dead timeout to sockets that 
     3          never even came up. Add a test. 
     4 
    15        * Warn when trying to put undef values into memcache. 
    26          (Henry Lyne <hlyne@livejournalinc.com>) 
  • trunk/api/perl/lib/Cache/Memcached.pm

    r797 r805  
    245245        if ($self && $self->{pref_ip}{$ip}) { 
    246246            socket($sock, PF_INET, SOCK_STREAM, $proto); 
     247            $sock_map{$sock} = $host; 
    247248            my $prefip = $self->{pref_ip}{$ip}; 
    248249            $sin = Socket::sockaddr_in($port,Socket::inet_aton($prefip)); 
     
    260261        unless ($connected) { 
    261262            socket($sock, PF_INET, SOCK_STREAM, $proto); 
     263            $sock_map{$sock} = $host; 
    262264            $sin = Socket::sockaddr_in($port,Socket::inet_aton($ip)); 
    263265            my $timeout = $self ? $self->{connect_timeout} : 0.25; 
     
    270272    } else { # it's a unix domain/local socket 
    271273        socket($sock, PF_UNIX, SOCK_STREAM, 0); 
     274        $sock_map{$sock} = $host; 
    272275        $sin = Socket::sockaddr_un($host); 
    273276        my $timeout = $self ? $self->{connect_timeout} : 0.25; 
     
    284287    select($old); 
    285288 
    286     $sock_map{$sock} = $host; 
    287289    $cache_sock{$host} = $sock; 
    288290