r28365 - in /branches/upstream/libpoe-component-client-keepalive-perl/current: CHANGES Client-Keepalive.pm META.yml Makefile.PL

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Dec 18 20:12:49 UTC 2008


Author: gregoa
Date: Thu Dec 18 20:12:47 2008
New Revision: 28365

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28365
Log:
[svn-upgrade] Integrating new upstream version, libpoe-component-client-keepalive-perl (0.2500)

Modified:
    branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES
    branches/upstream/libpoe-component-client-keepalive-perl/current/Client-Keepalive.pm
    branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml
    branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES?rev=28365&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES Thu Dec 18 20:12:47 2008
@@ -1,3 +1,27 @@
+=================================
+2008-12-09T06:15:39.900728Z v0_25
+=================================
+
+  2008-12-09 06:14:33 (r104) by rcaputo; Client-Keepalive.pm M
+
+    New version.
+
+  2008-12-09 04:55:21 (r103) by rcaputo; Client-Keepalive.pm M
+
+    Do not bother trying to shut down cancelled requests. Attempting to
+    do so only causes heartbreak and crashes when we dereference a string
+    rather than an arrayref.
+
+  2008-12-08 18:07:54 (r102) by rcaputo; Makefile.PL M
+
+    ExtUtils::MakeMaker officially added META_MERGE, which we now use. 
+
+  2008-12-08 17:49:43 (r101) by rcaputo; Client-Keepalive.pm M
+
+    Resolve a memory leak uncovered by jcasey and diagnosed by Apocalypse
+    in irc.perl.org #poe. Request IDs were allocated by not removed when
+    done, so the hash to prevent collisions would only grow over time. 
+
 =================================
 2008-12-07T03:53:59.984618Z v0_24
 =================================

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/Client-Keepalive.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/Client-Keepalive.pm?rev=28365&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/Client-Keepalive.pm (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/Client-Keepalive.pm Thu Dec 18 20:12:47 2008
@@ -1,4 +1,4 @@
-# $Id: Client-Keepalive.pm 99 2008-12-07 03:52:29Z rcaputo $
+# $Id: Client-Keepalive.pm 104 2008-12-09 06:14:33Z rcaputo $
 
 package POE::Component::Client::Keepalive;
 
@@ -6,7 +6,7 @@
 use strict;
 
 use vars qw($VERSION);
-$VERSION = "0.24";
+$VERSION = "0.25";
 
 use Carp qw(croak);
 use Errno qw(ETIMEDOUT);
@@ -156,20 +156,21 @@
       $self => {
         _start               => "_ka_initialize",
         _stop                => "_ka_stopped",
+        ka_add_to_queue      => "_ka_add_to_queue",
+        ka_cancel_dns_response => "_ka_cancel_dns_response",
         ka_conn_failure      => "_ka_conn_failure",
         ka_conn_success      => "_ka_conn_success",
+        ka_deallocate        => "_ka_deallocate",
+        ka_dns_response      => "_ka_dns_response",
+        ka_keepalive_timeout => "_ka_keepalive_timeout",
         ka_reclaim_socket    => "_ka_reclaim_socket",
         ka_relinquish_socket => "_ka_relinquish_socket",
         ka_request_timeout   => "_ka_request_timeout",
+        ka_resolve_request   => "_ka_resolve_request",
         ka_set_timeout       => "_ka_set_timeout",
         ka_shutdown          => "_ka_shutdown",
         ka_socket_activity   => "_ka_socket_activity",
-        ka_keepalive_timeout => "_ka_keepalive_timeout",
         ka_wake_up           => "_ka_wake_up",
-        ka_resolve_request   => "_ka_resolve_request",
-        ka_add_to_queue      => "_ka_add_to_queue",
-        ka_dns_response      => "_ka_dns_response",
-        ka_cancel_dns_response => "_ka_cancel_dns_response",
       },
     ],
   );
@@ -254,6 +255,7 @@
 
       # Remove the wheel-to-request index.
       delete $self->[SF_REQ_INDEX]{$request->[RQ_ID]};
+      _free_req_id($request->[RQ_ID]);
 
       next;
     }
@@ -416,48 +418,54 @@
     defined($req_id) and exists($active_req_ids{$req_id})
   );
 
-  my $request = $self->[SF_REQ_INDEX]{$req_id};
+  my $request = delete $self->[SF_REQ_INDEX]{$req_id};
   unless (defined $request) {
     DEBUG_DEALLOCATE and warn "deallocate could not find request $req_id";
     return;
   }
+  _free_req_id($request->[RQ_ID]);
+
+  # Now pass the vetted request & its ID into our manager session.
+  $poe_kernel->call("$self", "ka_deallocate", $request, $req_id);
+}
+
+sub _ka_deallocate {
+  my ($self, $heap, $request, $req_id) = @_[OBJECT, HEAP, ARG0, ARG1];
 
   my $conn_key = $request->[RQ_CONN_KEY];
   my $existing_connection = $self->_check_free_pool($conn_key);
 
+  # Existing connection.  Remove it from the pool, and delete the socket.
   if (defined $existing_connection) {
-    # remove it from the pool, delete the socket
     $self->_remove_socket_from_pool($existing_connection->{socket});
     DEBUG_DEALLOCATE and warn(
       "deallocate called, deleted already-connected socket"
     );
     return;
   }
-  else {
+
+  # No connection yet.  Cancel the request.
+  DEBUG_DEALLOCATE and warn(
+    "deallocate called without an existing connection.  ",
+    "cancelling connection request"
+  );
+
+  unless (exists $heap->{resolve}->{$request->[RQ_ADDRESS]}) {
     DEBUG_DEALLOCATE and warn(
-      "deallocate called without an existing connection.  ",
-      "cancelling connection request"
+      "deallocate cannot cancel dns -- no pending request"
     );
-
-    my $heap = $poe_kernel->get_active_session->get_heap;
-
-    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;
   }
+
+  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;
 }
 
 sub _ka_cancel_dns_response {
@@ -542,6 +550,7 @@
 
   # remove the wheel-to-request index
   delete $self->[SF_REQ_INDEX]{$request->[RQ_ID]};
+  _free_req_id($request->[RQ_ID]);
 
   # Discount the use by request key, removing the SF_USED record
   # entirely if it's now moot.
@@ -564,6 +573,7 @@
 
   # remove the wheel-to-request index
   delete $self->[SF_REQ_INDEX]{$request->[RQ_ID]};
+  _free_req_id($request->[RQ_ID]);
 
   # Remove the SF_USED placeholder, add in the socket, and store it
   # properly.
@@ -786,6 +796,10 @@
 
   # Stop any pending resolver requests.
   foreach my $host (keys %{$heap->{resolve}}) {
+    if ($heap->{resolve}{$host} eq 'cancelled') {
+      DEBUG and warn "SHT: Skipping shutdown for $host (already cancelled)";
+      next;
+    }
     DEBUG and warn "SHT: Shutting down resolver requests for $host";
     foreach my $request (@{$heap->{resolve}{$host}}) {
       $self->_shutdown_request($kernel, $request);
@@ -819,6 +833,7 @@
 
     # remove the wheel-to-request index
     delete $self->[SF_REQ_INDEX]{$request->[RQ_ID]};
+    _free_req_id($request->[RQ_ID]);
   }
 
   if (defined $request->[RQ_SESSION]) {

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml?rev=28365&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml Thu Dec 18 20:12:47 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               POE-Component-Client-Keepalive
-version:            0.24
+version:            0.25
 abstract:           Manages and keeps alive client connections
 author:
     - Rocco Caputo <rcaputo at cpan.org>
@@ -15,6 +15,7 @@
     directory:
         - t
         - inc
+        - mylib
 generated_by:       ExtUtils::MakeMaker version 6.48
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL?rev=28365&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL Thu Dec 18 20:12:47 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: Makefile.PL 93 2008-11-24 22:28:47Z rcaputo $
+# $Id: Makefile.PL 102 2008-12-08 18:07:54Z rcaputo $
 
 use strict;
 
@@ -10,14 +10,13 @@
 
 my @conditional_makefile;
 my $eu_mm_ver = $ExtUtils::MakeMaker::VERSION;
-if ( $eu_mm_ver > 6.30 or $eu_mm_ver =~ /^6\.30_/ ) {
+
+if ($eu_mm_ver >= 6.48) {
   push(
     @conditional_makefile,
-    EXTRA_META  => (
-      "no_index:\n" .
-      "    dir:\n" .
-      "        - mylib\n"
-    )
+    META_MERGE => {
+      no_index => { directory => "mylib" }
+    }
   );
 }
 




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