AnyEvent-Memcached
view release on metacpan or search on metacpan
lib/AnyEvent/Memcached/Peer.pm view on Meta::CPAN
use base 'AnyEvent::Connection';
use Carp;
use AnyEvent::Connection::Util;
use Scalar::Util qw(weaken);
#use Devel::Leak::Cb;
sub DEBUG () { 0 }
use AnyEvent::Memcached::Conn;
sub new {
my $self = shift->SUPER::new(
rawcon => 'AnyEvent::Memcached::Conn',
reconnect => 1,
@_,
);
$self->{waitingcb} = {};
$self;
}
sub connect {
my $self = shift;
lib/AnyEvent/Memcached/Peer.pm view on Meta::CPAN
warn "Peer $self->{host}:$self->{port} disconnected".(@_ ? ": @_" : '')."\n" if $self->{debug};
my $e = @_ ? "@_" : "disconnected";
for ( keys %{$self->{waitingcb}} ) {
if ($self->{waitingcb}{$_}) {
#warn "Cleanup: ",::sub_fullname( $self->{waitingcb}{$_} );
$self->{waitingcb}{$_}(undef,$e);
}
delete $self->{waitingcb}{$_};
}
} );
$self->SUPER::connect(@_);
return;
}
sub conntrack {
my $self = shift;
my ($method,$args,$cb) = @_;
if($self->{connecting} and $self->{failed}) {
warn "Is connecting, have fails => not connected" if DEBUG;
$cb and $cb->(undef, "Not connected");
return;
( run in 1.283 second using v1.01-cache-2.11-cpan-49f99fa48dc )