[libanyevent-handle-udp-perl] 36/60: Fix {, r, w}timeout_reset to actually work

Jonas Smedegaard js at alioth.debian.org
Mon Sep 30 10:05:43 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libanyevent-handle-udp-perl.

commit 91d85f25ad68bc3914933e0267f6a7b098d59cfe
Author: Leon Timmermans <fawaka at gmail.com>
Date:   Tue Dec 11 01:20:40 2012 +0100

    Fix {,r,w}timeout_reset to actually work
---
 Changes                    |    1 +
 lib/AnyEvent/Handle/UDP.pm |    7 ++++---
 t/20-timeout.t             |    5 +++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Changes b/Changes
index ca85cbe..a339791 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for AnyEvent-Handle-UDP
 
 {{$NEXT}}
+          Fix {,r,w}timeout_reset to actually work
           Made it work with old perl+old Socket.pm
 
 0.037     2012-11-15 00:29:31 Europe/Amsterdam
diff --git a/lib/AnyEvent/Handle/UDP.pm b/lib/AnyEvent/Handle/UDP.pm
index 60458d6..60bfd50 100644
--- a/lib/AnyEvent/Handle/UDP.pm
+++ b/lib/AnyEvent/Handle/UDP.pm
@@ -188,9 +188,10 @@ for my $dir ('', 'r', 'w') {
 		isa => sub { ref($_[0]) eq 'CODE' },
 	);
 	no strict 'refs';
-	*{$timeout_reset} = subname $timeout_reset, sub {
-		$activity = AE::now;
-	};
+	*{$timeout_reset} = subname($timeout_reset, sub {
+		my $self = shift;
+		$self->$activity(AE::now);
+	});
 }
 
 sub bind_to {
diff --git a/t/20-timeout.t b/t/20-timeout.t
index 7201cb1..f30c955 100644
--- a/t/20-timeout.t
+++ b/t/20-timeout.t
@@ -25,6 +25,11 @@ alarm 12;
 	cmp_ok AE::now, '>=', $start_time + 3, 'Three seconds have passed';
 	throws_ok { $cb2->recv } qr/Read Timeout/, 'Receive throws a timeout again';
 	cmp_ok AE::now, '>=', $start_time + 4.5, '1.5 more seconds have passed';
+	$server->timeout_reset;
+	my $cb3 = AE::cv;
+	$server->on_timeout(sub { $cb3->croak('Reset') });
+	throws_ok { $cb3->recv } qr/Reset/, 'Receive throws a timeout again';
+	cmp_ok AE::now, '>=', $start_time + 7.5, '3 more seconds have passed';
 }
 
 done_testing;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-handle-udp-perl.git



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