r24309 - in /trunk/libpoe-component-client-keepalive-perl: CHANGES Client-Keepalive.pm META.yml debian/changelog debian/control

emhn-guest at users.alioth.debian.org emhn-guest at users.alioth.debian.org
Fri Aug 15 13:10:20 UTC 2008


Author: emhn-guest
Date: Fri Aug 15 13:10:18 2008
New Revision: 24309

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24309
Log:
* New upstream release

Modified:
    trunk/libpoe-component-client-keepalive-perl/CHANGES
    trunk/libpoe-component-client-keepalive-perl/Client-Keepalive.pm
    trunk/libpoe-component-client-keepalive-perl/META.yml
    trunk/libpoe-component-client-keepalive-perl/debian/changelog
    trunk/libpoe-component-client-keepalive-perl/debian/control

Modified: trunk/libpoe-component-client-keepalive-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/CHANGES?rev=24309&op=diff
==============================================================================
--- trunk/libpoe-component-client-keepalive-perl/CHANGES (original)
+++ trunk/libpoe-component-client-keepalive-perl/CHANGES Fri Aug 15 13:10:18 2008
@@ -1,3 +1,26 @@
+=================================
+2008-08-06T19:01:34.101195Z v0_21
+=================================
+
+  2008-08-06 19:01:16 (r88) by rcaputo; Client-Keepalive.pm M
+
+    Reverse the sense of the dotted-quad address test. Resolves
+    rt.cpan.org ticket 38219, reported by Apocalypse. 
+
+=================================
+2008-07-13T06:50:02.417909Z v0_20
+=================================
+
+  2008-07-13 06:47:46 (r86) by rcaputo; Client-Keepalive.pm M
+
+    Time for a new release.
+
+  2008-07-13 06:23:06 (r85) by rcaputo; Client-Keepalive.pm M
+
+    Improve handling of canceled requests. Avoids DNS response errors and
+    the dreaded "unexpectedly undefined requests" crash. Fix prompted by
+    a test case from Jeff Bisbee. 
+
 ===================================
 2008-03-24T16:40:25.441638Z v0_1001
 ===================================

Modified: trunk/libpoe-component-client-keepalive-perl/Client-Keepalive.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/Client-Keepalive.pm?rev=24309&op=diff
==============================================================================
--- trunk/libpoe-component-client-keepalive-perl/Client-Keepalive.pm (original)
+++ trunk/libpoe-component-client-keepalive-perl/Client-Keepalive.pm Fri Aug 15 13:10:18 2008
@@ -1,4 +1,4 @@
-# $Id: Client-Keepalive.pm 83 2008-03-24 16:37:59Z rcaputo $
+# $Id: Client-Keepalive.pm 88 2008-08-06 19:01:16Z rcaputo $
 
 package POE::Component::Client::Keepalive;
 
@@ -6,7 +6,7 @@
 use strict;
 
 use vars qw($VERSION);
-$VERSION = "0.1001";
+$VERSION = "0.21";
 
 use Carp qw(croak);
 use Errno qw(ETIMEDOUT);
@@ -23,6 +23,8 @@
 };
 
 use constant DEBUG => 0;
+use constant DEBUG_DNS => DEBUG || 0;
+use constant DEBUG_DEALLOCATE => DEBUG || 0;
 
 # Manage connection request IDs.
 
@@ -187,7 +189,7 @@
 # _ka_stopped and DESTROY catch this either way the death occurs.
 
 sub _ka_stopped {
-	$_[OBJECT][SF_SHUTDOWN] = 1;
+  $_[OBJECT][SF_SHUTDOWN] = 1;
 }
 
 sub DESTROY {
@@ -412,7 +414,7 @@
 
   my $request = $self->[SF_REQ_INDEX]{$req_id};
   unless (defined $request) {
-    DEBUG and warn "deallocate could not find request $req_id";
+    DEBUG_DEALLOCATE and warn "deallocate could not find request $req_id";
     return;
   }
 
@@ -422,17 +424,32 @@
   if (defined $existing_connection) {
     # remove it from the pool, delete the socket
     $self->_remove_socket_from_pool($existing_connection->{socket});
-    DEBUG and warn( "deallocate called, deleted already-connected socket" );
+    DEBUG_DEALLOCATE and warn(
+      "deallocate called, deleted already-connected socket"
+    );
     return;
   }
   else {
-    DEBUG and warn(
+    DEBUG_DEALLOCATE and warn(
       "deallocate called without an existing connection.  ",
       "cancelling connection request"
     );
 
     my $heap = $poe_kernel->get_active_session->get_heap;
-    $heap->{resolve}->{$request->[RQ_ADDRESS]} = "cancelled";
+
+    unless (exists $heap->{resolve}->{$request->[RQ_ADDRESS]}) {
+      DEBUG_DEALLOCATE and warn(
+        "deallocate cannot cancel dns -- no pending request"
+      );
+      return;
+    }
+
+    if ($heap->{resolve}->{$request->[RQ_ADDRESS]} eq 'cancelled') {
+      DEBUG_DEALLOCATE and warn(
+        "deallocate cannot cancel dns -- request already cancelled"
+      );
+      return;
+    }
 
     $poe_kernel->call( "$self", ka_cancel_dns_response => $request );
     return;
@@ -443,6 +460,7 @@
   my ($self, $kernel, $heap, $request) = @_[OBJECT, KERNEL, HEAP, ARG0];
 
   my $address = $request->[RQ_ADDRESS];
+  DEBUG_DNS and warn "DNS: canceling request for $address\n";
   my $requests = $heap->{resolve}{$address};
 
   # Remove the resolver request for the address of this connection
@@ -450,7 +468,6 @@
 
   my $req_index = @$requests;
   while ($req_index--) {
-    next if $requests->[$req_index] eq "cancelled";
     next unless $requests->[$req_index] == $request;
     splice(@$requests, $req_index, 1);
     last;
@@ -460,7 +477,8 @@
   # requests to resolve that address.
 
   unless (@$requests) {
-    $heap->{resolve}{$address} = ["cancelled"];
+    DEBUG_DNS and warn "DNS: canceled all requests for $address";
+    $heap->{resolve}{$address} = 'cancelled';
   }
 
   # cancel our attempt to connect
@@ -755,7 +773,6 @@
   foreach my $host (keys %{$heap->{resolve}}) {
     DEBUG and warn "SHT: Shutting down resolver requests for $host";
     foreach my $request (@{$heap->{resolve}{$host}}) {
-      next if $request eq "cancelled";
       $self->_shutdown_request($kernel, $request);
     }
   }
@@ -819,36 +836,42 @@
   my ($self, $kernel, $heap, $request) = @_[OBJECT, KERNEL, HEAP, ARG0];
 
   my $host = $request->[RQ_ADDRESS];
-  if ($host !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
-
-    if (exists $heap->{resolve}->{$host}) {
-      DEBUG and warn "DNS: $host is piggybacking on a pending lookup.\n";
-      push @{$heap->{resolve}->{$host}}, $request;
-    } else {
-      DEBUG and warn "DNS: $host is being looked up in the background.\n";
-      $heap->{resolve}->{$host} = [ $request ];
-
-      my $response = $self->[SF_RESOLVER]->resolve(
-        event   => 'ka_dns_response',
-        host    => $host,
-        context => 1,
-      );
-
-      if ($response) {
-        DEBUG and warn "DNS: resolver returned immediately";
-        $kernel->yield (ka_dns_response => $response);
-      }
-    }
-  } else {
-    DEBUG and warn "DNS: $host may block while it's looked up.\n";
+
+  # Skip DNS resolution if it's already a dotted quad.
+  # TODO - Not all dotted quads are good.
+  if ($host =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
+    DEBUG_DNS and warn "DNS: $host is a dotted quad; skipping lookup";
     $kernel->call("$self", ka_add_to_queue => $request);
-  }
+    return;
+  }
+
+  # It's already pending DNS resolution.  Combine this with previous.
+  if (exists $heap->{resolve}->{$host}) {
+    DEBUG_DNS and warn "DNS: $host is piggybacking on a pending lookup.\n";
+    push @{$heap->{resolve}->{$host}}, $request;
+    return;
+  }
+
+  # New request.  Start lookup.
+  $heap->{resolve}->{$host} = [ $request ];
+
+  my $response = $self->[SF_RESOLVER]->resolve(
+    event   => 'ka_dns_response',
+    host    => $host,
+    context => 1, # required but unused
+  );
+
+  if ($response) {
+    DEBUG_DNS and warn "DNS: immediate resolution for $host";
+    $kernel->yield(ka_dns_response => $response);
+    return;
+  }
+
+  DEBUG_DNS and warn "DNS: looking up $host in the background.\n";
 }
 
 sub _ka_dns_response {
   my ($self, $kernel, $heap, $response) = @_[OBJECT, KERNEL, HEAP, ARG0];
-
-  # Nothing to do if we're shut down.
 
   my $request_address = $response->{'host'};
   my $response_object = $response->{'response'};
@@ -856,27 +879,23 @@
 
   my $requests = delete $heap->{resolve}->{$request_address};
 
-  DEBUG and warn "DNS: request address = $request_address";
-
-  # No requests are on record for this lookup.
-  # TODO - What if the requests were canceled, possibly due to a
-  # timeout?  The answer: Timeouts don't cancel DNS requests, so we
-  # still get the response (eventually) and clean up the resolver
-  # thingy here.  DNS request piggybacking should prevent this from
-  # being called multiple times, so we should be safe there, too.
-  # Leave the die() in until coverage == 100%, so we can catch
-  # possible bugs in the future.
-  #
-  # If it says "cancelled", it was.
-  return unless defined $requests;
+  DEBUG_DNS and warn "DNS: got response for request address $request_address";
+
+  # Requests on record.
   if (defined $requests) {
-    if (ref $requests eq 'ARRAY') {
-        return if grep { $_ eq 'cancelled' } @$requests;
-    } else {
-      die "!!!: got a defined requests but NOT an arrayref";
-    }
-  } else {
-     die "!!!: Unexpectedly undefined requests";
+    # We can receive responses for canceled requests.  Ignore them: we
+    # cannot cancel PoCo::Client::DNS requests, so this is how we reap
+    # them when they're canceled.
+    if ($requests eq 'cancelled') {
+      DEBUG_DNS and warn "DNS: reaping cancelled request for $request_address";
+      return;
+    }
+    unless (ref $requests eq 'ARRAY') {
+      die "DNS: got an unknown requests for $request_address: $requests";
+    }
+  }
+  else {
+    die "DNS: Unexpectedly undefined requests for $request_address";
   }
 
   # No response.  This is an error.  Cancel all requests for the
@@ -893,7 +912,7 @@
     # don't need this because we ask for only A answers anyway
     #next unless $answer->type eq "A";
 
-    DEBUG and warn "DNS: $request_address resolves to ", $answer->rdatastr;
+    DEBUG_DNS and warn "DNS: $request_address resolves to ", $answer->rdatastr;
 
     foreach my $request (@$requests) {
       # Don't bother continuing inactive requests.
@@ -908,7 +927,7 @@
 
   # Didn't return here.  No address record for the host?
   foreach my $request (@$requests) {
-    DEBUG and warn "DNS: $request_address does not resolve";
+    DEBUG_DNS and warn "DNS: $request_address does not resolve";
     _respond_with_error($request, "resolve", undef, "Host has no address."),
   }
 }

Modified: trunk/libpoe-component-client-keepalive-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/META.yml?rev=24309&op=diff
==============================================================================
--- trunk/libpoe-component-client-keepalive-perl/META.yml (original)
+++ trunk/libpoe-component-client-keepalive-perl/META.yml Fri Aug 15 13:10:18 2008
@@ -1,18 +1,18 @@
 --- #YAML:1.0
 name:                POE-Component-Client-Keepalive
-version:             0.1001
+version:             0.21
 abstract:            Manages and keeps alive client connections
 license:             perl
-generated_by:        ExtUtils::MakeMaker version 6.31
+author:              
+    - Rocco Caputo <rcaputo at cpan.org>
+generated_by:        ExtUtils::MakeMaker version 6.44
 distribution_type:   module
 requires:     
     POE:                           0.31
     POE::Component::Client::DNS:   0.9801
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
-    version: 1.2
-author:
-    - Rocco Caputo <rcaputo at cpan.org>
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3
 no_index:
     dir:
         - mylib

Modified: trunk/libpoe-component-client-keepalive-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/debian/changelog?rev=24309&op=diff
==============================================================================
--- trunk/libpoe-component-client-keepalive-perl/debian/changelog (original)
+++ trunk/libpoe-component-client-keepalive-perl/debian/changelog Fri Aug 15 13:10:18 2008
@@ -1,3 +1,9 @@
+libpoe-component-client-keepalive-perl (0.21-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Ernesto Hernández-Novich (USB) <emhn at usb.ve>  Fri, 15 Aug 2008 08:38:11 -0430
+
 libpoe-component-client-keepalive-perl (0.1001-1) unstable; urgency=low
 
   [ Ernesto Hernández-Novich (USB) ]

Modified: trunk/libpoe-component-client-keepalive-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/debian/control?rev=24309&op=diff
==============================================================================
--- trunk/libpoe-component-client-keepalive-perl/debian/control (original)
+++ trunk/libpoe-component-client-keepalive-perl/debian/control Fri Aug 15 13:10:18 2008
@@ -7,7 +7,7 @@
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Damyan Ivanov <dmn at debian.org>,
  Ernesto Hernández-Novich (USB) <emhn at usb.ve>
-Standards-Version: 3.7.3
+Standards-Version: 3.8.0
 Homepage: http://search.cpan.org/dist/POE-Component-Client-Keepalive/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libpoe-component-client-keepalive-perl/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libpoe-component-client-keepalive-perl/




More information about the Pkg-perl-cvs-commits mailing list