r27759 - in /branches/upstream/libpoe-component-client-keepalive-perl/current: CHANGES Client-Keepalive.pm META.yml Makefile.PL t/04_free_each.t t/06_activity.t t/08_quick_reuse.t t/11_dead_socket.t t/12_extref.t t/50_bisbee_timeout.t

emhn-guest at users.alioth.debian.org emhn-guest at users.alioth.debian.org
Fri Dec 5 11:54:31 UTC 2008


Author: emhn-guest
Date: Fri Dec  5 11:54:28 2008
New Revision: 27759

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

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
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/04_free_each.t
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/06_activity.t
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/08_quick_reuse.t
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/11_dead_socket.t
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/12_extref.t
    branches/upstream/libpoe-component-client-keepalive-perl/current/t/50_bisbee_timeout.t

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=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/CHANGES Fri Dec  5 11:54:28 2008
@@ -1,3 +1,39 @@
+=================================
+2008-11-24T22:37:36.391530Z v0_23
+=================================
+
+  2008-11-24 22:36:21 (r96) by rcaputo; Client-Keepalive.pm M
+
+    Bump again for release.
+
+  2008-11-24 22:35:43 (r95) by rcaputo; Client-Keepalive.pm M
+
+    Don't bother with setsockopt() on filehandles that aren't open. 
+
+=================================
+2008-11-24T22:30:36.636504Z v0_22
+=================================
+
+  2008-11-24 22:28:47 (r93) by rcaputo; Makefile.PL M
+
+    Rely on modern Client::DNS.
+
+  2008-11-24 22:27:14 (r92) by rcaputo
+  t/12_extref.t M; t/50_bisbee_timeout.t M; t/08_quick_reuse.t M;
+  t/11_dead_socket.t M; Client-Keepalive.pm M
+
+    Bump up the version, and fix some tab damage.
+
+  2008-11-24 20:12:23 (r91) by rcaputo
+  t/06_activity.t M; t/04_free_each.t M; Client-Keepalive.pm M
+
+    EXPERIMENTAL: Turn off SO_LINGER when closing kept-alive sockets due
+    to activity while in the pool or being kept in the pool too long. 
+
+  2008-11-21 17:52:56 (r90) by rcaputo; Client-Keepalive.pm M
+
+    Ignore Client::DNS responses if Client:Keepalive has shut down.
+
 =================================
 2008-08-06T19:01:34.101195Z v0_21
 =================================

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=27759&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 Fri Dec  5 11:54:28 2008
@@ -1,4 +1,4 @@
-# $Id: Client-Keepalive.pm 88 2008-08-06 19:01:16Z rcaputo $
+# $Id: Client-Keepalive.pm 96 2008-11-24 22:36:21Z rcaputo $
 
 package POE::Component::Client::Keepalive;
 
@@ -6,10 +6,11 @@
 use strict;
 
 use vars qw($VERSION);
-$VERSION = "0.21";
+$VERSION = "0.23";
 
 use Carp qw(croak);
 use Errno qw(ETIMEDOUT);
+use Socket qw(SOL_SOCKET SO_LINGER);
 
 use POE;
 use POE::Wheel::SocketFactory;
@@ -679,49 +680,60 @@
   my $request_key = $used->[USED_KEY];
   $self->_decrement_used_each($request_key);
 
-  # only try to reuse it if it still works
-  my ($nfound, $status);
-  if (defined fileno($socket)) {
-    DEBUG and warn "RECLAIM: checking if socket still works";
-    my $rin = '';
-    vec($rin, fileno($socket), 1) = 1;
-    my ($rout, $eout);
-    $nfound = select ($rout=$rin, undef, $eout=$rin, 0);
-    DEBUG and warn "RECLAIM: select results: $nfound";
-
-    if ($nfound == -1) {
-      die "select failed: $!";
-    }
-
-    if ($nfound) {
-      use bytes;
-      DEBUG and warn "RECLAIM: uh oh, socket activity";
-      $status = sysread($socket, my $buf = "", 65536);
-      if (DEBUG and defined $status) {
-        warn "RECLAIM: read $status bytes. 0 means EOF";
-      }
-    }
-
-    if (!$nfound or $status != 0) {
-      DEBUG and warn "RECLAIM: reclaiming socket";
-
-      # Watch the socket, and set a keep-alive timeout.
-      $kernel->select_read($socket, "ka_socket_activity");
-      my $timer_id = $kernel->delay_set(
-        ka_keepalive_timeout => $self->[SF_KEEPALIVE], $socket
+  # Socket is closed.  We can't reuse it.
+  unless (defined fileno $socket) {
+    DEBUG and warn "RECLAIM: freed socket has previously been closed";
+    goto &_ka_wake_up;
+  }
+
+  # Socket is still open.  Check for lingering data.
+  DEBUG and warn "RECLAIM: checking if socket still works";
+
+  # Check for data on the socket, which implies that the server
+  # doesn't know we're done.  That leads to desynchroniziation on the
+  # protocol level, which strongly implies that we can't reuse the
+  # socket.  In this case, we'll make a quick attempt at fetching all
+  # the data, then close the socket.
+
+  my $rin = '';
+  vec($rin, fileno($socket), 1) = 1;
+  my ($rout, $eout);
+  my $socket_is_active = select ($rout=$rin, undef, $eout=$rin, 0);
+
+  if ($socket_is_active) {
+    DEBUG and warn "RECLAIM: socket is still active; trying to drain";
+    use bytes;
+    my $socket_had_data = sysread($socket, my $buf = "", 65536) || 0;
+    DEBUG and warn "RECLAIM: socket had $socket_had_data bytes. 0 means EOF";
+    DEBUG and warn "RECLAIM: Giving up on socket.";
+
+    # Avoid common FIN_WAIT_2 issues.
+    if ($socket_had_data) {
+      setsockopt($socket, SOL_SOCKET, SO_LINGER, pack("sll",1,0,0)) or die(
+        "setsockopt: $!"
       );
-
-      # Record the socket as free to be used.
-      $self->[SF_POOL]{$request_key}{$socket} = $socket;
-      $self->[SF_SOCKETS]{$socket} = [
-        $request_key,       # SK_KEY
-        $timer_id,          # SK_TIMER
-      ];
-    }
-  }
-  else {
-    DEBUG and warn "RECLAIM: freed socket has previously been closed";
-  }
+    }
+
+    goto &_ka_wake_up;
+  }
+
+  # Socket is alive and has no data, so it's in a quiet, theoretically
+  # reclaimable state.
+
+  DEBUG and warn "RECLAIM: reclaiming socket";
+
+  # Watch the socket, and set a keep-alive timeout.
+  $kernel->select_read($socket, "ka_socket_activity");
+  my $timer_id = $kernel->delay_set(
+    ka_keepalive_timeout => $self->[SF_KEEPALIVE], $socket
+  );
+
+  # Record the socket as free to be used.
+  $self->[SF_POOL]{$request_key}{$socket} = $socket;
+  $self->[SF_SOCKETS]{$socket} = [
+    $request_key,       # SK_KEY
+    $timer_id,          # SK_TIMER
+  ];
 
   goto &_ka_wake_up;
 }
@@ -825,10 +837,14 @@
     warn "CON: Got activity on socket for $key";
   }
 
+  # Any socket activity on a kept-alive socket implies that the socket
+  # is no longer reusable.
+
   use bytes;
-  return if sysread($socket, my $buf = "", 65536);
-
-  DEBUG and warn "CON: socket got EOF or an error. removing it from the pool";
+  my $socket_had_data = sysread($socket, my $buf = "", 65536) || 0;
+  DEBUG and warn "CON: socket had $socket_had_data bytes. 0 means EOF";
+  DEBUG and warn "CON: Removing socket from the pool";
+
   $self->_remove_socket_from_pool($socket);
 }
 
@@ -872,6 +888,9 @@
 
 sub _ka_dns_response {
   my ($self, $kernel, $heap, $response) = @_[OBJECT, KERNEL, HEAP, ARG0];
+
+  # We've shut down.  Nothing to do here.
+  return if $self->[SF_SHUTDOWN];
 
   my $request_address = $response->{'host'};
   my $response_object = $response->{'response'};
@@ -901,11 +920,14 @@
   # No response.  This is an error.  Cancel all requests for the
   # address.  Tell everybody that their requests timed out.
   unless (defined $response_object) {
+    DEBUG_DNS and warn "DNS: undefined response = error";
     foreach my $request (@$requests) {
       _respond_with_error($request, "resolve", undef, $response_error),
     }
     return;
   }
+
+  DEBUG_DNS and warn "DNS: got a response";
 
   # A response!
   foreach my $answer ($response_object->answer()) {
@@ -983,6 +1005,13 @@
 
   $poe_kernel->alarm_remove($socket_rec->[SK_TIMER]);
   $poe_kernel->select_read($socket, undef);
+
+  # Avoid common FIN_WAIT_2 issues.
+  if (fileno $socket) {
+    setsockopt($socket, SOL_SOCKET, SO_LINGER, pack("sll",1,0,0)) or die(
+      "setsockopt: $!"
+    );
+  }
 }
 
 # Internal function.  NOT AN EVENT HANDLER.
@@ -1004,7 +1033,7 @@
   my ($request, $fields) = @_;
 
   # Bail out early if the request isn't active.
-  return unless $request->[RQ_ACTIVE];
+  return unless $request->[RQ_ACTIVE] and $request->[RQ_SESSION];
 
   $poe_kernel->post(
     $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=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/META.yml Fri Dec  5 11:54:28 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                POE-Component-Client-Keepalive
-version:             0.21
+version:             0.23
 abstract:            Manages and keeps alive client connections
 license:             perl
 author:              
@@ -9,7 +9,7 @@
 distribution_type:   module
 requires:     
     POE:                           0.31
-    POE::Component::Client::DNS:   0.9801
+    POE::Component::Client::DNS:   1.01
 meta-spec:
     url:     http://module-build.sourceforge.net/META-spec-v1.3.html
     version: 1.3

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=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/Makefile.PL Fri Dec  5 11:54:28 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: Makefile.PL 78 2006-11-06 19:23:47Z rcaputo $
+# $Id: Makefile.PL 93 2008-11-24 22:28:47Z rcaputo $
 
 use strict;
 
@@ -33,7 +33,7 @@
   },
   PREREQ_PM    => {
     'POE'                         => 0.31,
-    'POE::Component::Client::DNS' => 0.9801,
+    'POE::Component::Client::DNS' => 1.01,
   },
   dist         => {
     COMPRESS   => 'gzip -9f',

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/04_free_each.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/04_free_each.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/04_free_each.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/04_free_each.t Fri Dec  5 11:54:28 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: 04_free_each.t 37 2005-09-04 18:56:42Z rcaputo $
+# $Id: 04_free_each.t 91 2008-11-24 20:12:23Z rcaputo $
 
 # Testing the bits that keep track of connections per connection key.
 
@@ -75,10 +75,10 @@
 
   return unless keys(%{$heap->{conn}}) == 2;
 
-	# Shut this one down.
-	$heap->{conn}{$which}->start();
-	$heap->{conn}{$which}->wheel()->shutdown_input();
-	$heap->{conn}{$which}->wheel()->shutdown_output();
+  # Shut this one down.
+  $heap->{conn}{$which}->start();
+  $heap->{conn}{$which}->wheel()->shutdown_input();
+  $heap->{conn}{$which}->wheel()->shutdown_output();
 
   # Free all heaped connections.
   delete $heap->{conn};
@@ -103,22 +103,22 @@
 }
 
 sub and_free {
-	my ($heap, $stuff) = @_[HEAP, ARG0];
+  my ($heap, $stuff) = @_[HEAP, ARG0];
 
   my $conn  = delete $stuff->{connection};
   my $which = $stuff->{context};
 
   ok(defined($conn), "$which connection created successfully");
   is(
-		$stuff->{from_cache}, 'immediate',
-		"third connection honored from the pool"
-	);
+    $stuff->{from_cache}, 'immediate',
+    "third connection honored from the pool"
+  );
 
-	# Free the connection first.
-	# Close its internal socket before freeing.  This will ensure that
-	# the connection manager can cope with such things.
-	close $conn->[POE::Component::Connection::Keepalive::CK_SOCKET];
-	$conn = undef;
+  # Free the connection first.
+  # Close its internal socket before freeing.  This will ensure that
+  # the connection manager can cope with such things.
+  close $conn->[POE::Component::Connection::Keepalive::CK_SOCKET];
+  $conn = undef;
 
   TestServer->shutdown();
   $heap->{cm}->shutdown();

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/06_activity.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/06_activity.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/06_activity.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/06_activity.t Fri Dec  5 11:54:28 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: 06_activity.t 17 2005-05-06 15:58:31Z martijn $
+# $Id: 06_activity.t 91 2008-11-24 20:12:23Z rcaputo $
 
 # Test activity on idle connections in the pool.
 
@@ -33,21 +33,24 @@
   }
 );
 
+# Start the connection manager, and allocate a connection to our test
+# server.
+
 sub start {
   my $heap = $_[HEAP];
+  $heap->{cm} = POE::Component::Client::Keepalive->new();
+  $heap->{cm}->allocate(
+    scheme  => "http",
+    addr    => "localhost",
+    port    => PORT,
+    event   => "got_conn",
+    context => "first",
+  );
+}
 
-  $heap->{cm} = POE::Component::Client::Keepalive->new();
-
-  {
-    $heap->{cm}->allocate(
-      scheme  => "http",
-      addr    => "localhost",
-      port    => PORT,
-      event   => "got_conn",
-      context => "first",
-    );
-  }
-}
+# A connection has been allocated.
+# Tell the test server to send us something.
+# Discard the connection before we can retrieve from it.
 
 sub got_conn {
   my ($heap, $stuff) = @_[HEAP, ARG0..$#_];
@@ -65,9 +68,8 @@
   # Everything that was sent to it remains unread.
 }
 
-# Reallocate the free socket.  See if any input is on it.  There
-# should be none, as it was all directed to /dev/null while the socket
-# was free.
+# Reallocate the free socket.  It should be asynchronous because there
+# was data on the socket and the connection could not be reused.
 
 sub check_for_input {
   my ($kernel, $heap) = @_[KERNEL, HEAP];
@@ -87,7 +89,10 @@
   my ($kernel, $heap, $stuff) = @_[KERNEL, HEAP, ARG0..$#_];
 
   $heap->{conn} = $stuff->{connection};
-  is($stuff->{from_cache}, 'immediate', "second connection established synchronously");
+  is(
+    $stuff->{from_cache}, undef,
+    "second connection established assynchronously"
+  );
 
   $heap->{conn}->start(
     InputEvent => "got_input",

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/08_quick_reuse.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/08_quick_reuse.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/08_quick_reuse.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/08_quick_reuse.t Fri Dec  5 11:54:28 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: 08_quick_reuse.t 81 2008-03-24 05:50:40Z rcaputo $
+# $Id: 08_quick_reuse.t 92 2008-11-24 22:27:14Z rcaputo $
 
 # Test rapid connection reuse.  Sets the maximum overall connections
 # to a low number.  Allocate up to the maximum.  Reuse one of the
@@ -108,30 +108,30 @@
   my $conn  = delete $stuff->{connection};
   my $which = $stuff->{context};
 
-	if ($which eq 'third') {
-		is(
-			$stuff->{from_cache}, 'immediate',
-			"$which connection request honored from pool"
-		);
-		return;
-	}
+  if ($which eq 'third') {
+    is(
+      $stuff->{from_cache}, 'immediate',
+      "$which connection request honored from pool"
+    );
+    return;
+  }
 
-	if ($which eq 'fourth') {
-		ok(
-			!defined ($stuff->{from_cache}),
-			"$which connection request honored from pool"
-		);
-		ok(defined($conn), "$which connection established asynchronously");
+  if ($which eq 'fourth') {
+    ok(
+      !defined ($stuff->{from_cache}),
+      "$which connection request honored from pool"
+    );
+    ok(defined($conn), "$which connection established asynchronously");
 
-		# Free the connection first.
-		$conn = undef;
+    # Free the connection first.
+    $conn = undef;
 
-		TestServer->shutdown();
-		$heap->{cm}->shutdown();
-		return;
-	}
+    TestServer->shutdown();
+    $heap->{cm}->shutdown();
+    return;
+  }
 
-	die;
+  die;
 }
 
 POE::Kernel->run();

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/11_dead_socket.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/11_dead_socket.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/11_dead_socket.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/11_dead_socket.t Fri Dec  5 11:54:28 2008
@@ -29,8 +29,8 @@
     got_first_conn  => \&got_first_conn,
     cleanup1        => \&cleanup1,
     cleanup         => \&cleanup,
-    error	    => \&error,
-    input	    => \&input,
+    error      => \&error,
+    input      => \&input,
   }
 );
 
@@ -79,16 +79,16 @@
   if ($which eq 'first') {
     ok(not (defined ($stuff->{from_cache})), "$which not from cache");
     my $wheel = $conn->start(
-    	ErrorEvent => 'error',
-	InputEvent => 'cleanup1',
+      ErrorEvent => 'error',
+  InputEvent => 'cleanup1',
       );
     $heap->{conn} = $conn;
     TestServer->send_something;
   } else {
     ok(not (defined ($stuff->{from_cache})), "$which not from cache");
     my $wheel = $conn->start(
-    	ErrorEvent => 'error',
-	InputEvent => 'input',
+      ErrorEvent => 'error',
+  InputEvent => 'input',
       );
     TestServer->send_something;
     $heap->{conn} = $conn;

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/12_extref.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/12_extref.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/12_extref.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/12_extref.t Fri Dec  5 11:54:28 2008
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: 12_extref.t 43 2006-03-24 02:44:32Z rcaputo $
+# $Id: 12_extref.t 92 2008-11-24 22:27:14Z rcaputo $
 # vim: filetype=perl
 
 # Make sure that client sessions stay alive while they're waiting for
@@ -27,7 +27,7 @@
 POE::Session->create(
   inline_states => {
     _start   => \&start,
-		_stop    => \&stop,
+    _stop    => \&stop,
     got_conn => \&got_conn,
   }
 );
@@ -35,13 +35,13 @@
 sub start {
   my $heap = $_[HEAP];
 
-	$global_cm->allocate(
-		scheme  => "http",
-		addr    => "127.0.0.1",
-		port    => PORT,
-		event   => "got_conn",
-		context => "first",
-	);
+  $global_cm->allocate(
+    scheme  => "http",
+    addr    => "127.0.0.1",
+    port    => PORT,
+    event   => "got_conn",
+    context => "first",
+  );
 }
 
 sub got_conn {
@@ -50,16 +50,16 @@
   my $conn  = $stuff->{connection};
   my $which = $stuff->{context};
 
-	ok( defined($conn), "got the connection" );
+  ok( defined($conn), "got the connection" );
 
-	$global_cm->shutdown() unless $heap->{cm_shutdown}++;
+  $global_cm->shutdown() unless $heap->{cm_shutdown}++;
   TestServer->shutdown() unless $heap->{ts_shutdown}++;
 }
 
 sub stop {
-	my $heap = $_[HEAP];
+  my $heap = $_[HEAP];
 
-	$global_cm->shutdown() unless $heap->{cm_shutdown}++;
+  $global_cm->shutdown() unless $heap->{cm_shutdown}++;
   TestServer->shutdown() unless $heap->{ts_shutdown}++;
 }
 

Modified: branches/upstream/libpoe-component-client-keepalive-perl/current/t/50_bisbee_timeout.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-keepalive-perl/current/t/50_bisbee_timeout.t?rev=27759&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-keepalive-perl/current/t/50_bisbee_timeout.t (original)
+++ branches/upstream/libpoe-component-client-keepalive-perl/current/t/50_bisbee_timeout.t Fri Dec  5 11:54:28 2008
@@ -12,12 +12,12 @@
 use POE::Component::Client::Keepalive;
 
 POE::Session->create(
-	inline_states => {
-		_child    => sub { },
-		_start    => \&start,
-		_stop     => \&crom_count_the_responses,
-		got_resp  => \&got_resp,
-	}
+  inline_states => {
+    _child    => sub { },
+    _start    => \&start,
+    _stop     => \&crom_count_the_responses,
+    got_resp  => \&got_resp,
+  }
 );
 
 POE::Kernel->run();
@@ -29,36 +29,36 @@
 # like "Host has no address."
 
 sub start {
-	my $heap = $_[HEAP];
+  my $heap = $_[HEAP];
 
-	$heap->{errors} = [ ];
+  $heap->{errors} = [ ];
 
-	$heap->{cm} = POE::Component::Client::Keepalive->new();
+  $heap->{cm} = POE::Component::Client::Keepalive->new();
 
-	$heap->{cm}->allocate(
-		scheme => "http",
-		addr   => "seriously-hoping-this-never-resolves.fail",
-		port   => 80,
-		event  => "got_resp",
-		context => "moo",
-		timeout => -1,
-	);
+  $heap->{cm}->allocate(
+    scheme => "http",
+    addr   => "seriously-hoping-this-never-resolves.fail",
+    port   => 80,
+    event  => "got_resp",
+    context => "moo",
+    timeout => -1,
+  );
 }
 
 # We received a response.  Count it.
 
 sub got_resp {
-	my ($heap, $stuff) = @_[HEAP, ARG0];
-	push @{$heap->{errors}}, $stuff->{function};
+  my ($heap, $stuff) = @_[HEAP, ARG0];
+  push @{$heap->{errors}}, $stuff->{function};
 }
 
 # End of run.  We're good if we receive only one timeout response.
 
 sub crom_count_the_responses {
-	my @errors = @{$_[HEAP]{errors}};
-	ok(
-		@errors == 1,
-		"should have received one response (actual=" .  @errors . ")"
-	);
-	ok( $errors[0] eq "connect", "the one response was a connect error");
+  my @errors = @{$_[HEAP]{errors}};
+  ok(
+    @errors == 1,
+    "should have received one response (actual=" .  @errors . ")"
+  );
+  ok( $errors[0] eq "connect", "the one response was a connect error");
 }




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