This queue is for tickets about the Danga-Socket CPAN distribution.

Report information
The Basics
Id:
72670
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
NML [...] cpan.org
Requestors:
nicolas.rochelemagne [...] cpanel.net
Cc:
AdminCc:

BugTracker
Severity:
Unimportant
Broken in:
(no value)
Fixed in:
1.62



CC: Nicolas Rochelemagne <nicolas.rochelemagne@cpanel.net>
Subject: [PATCH] simple optimization by caching pack
Date: Wed, 23 Nov 2011 12:38:50 -0600
To: bug-Danga-Socket@rt.cpan.org
From: nicolas.rochelemagne@cpanel.net
From: Nicolas Rochelemagne <nicolas.rochelemagne@cpanel.net> --- lib/Danga/Socket.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/Danga/Socket.pm b/lib/Danga/Socket.pm index 9bebf54..8deeafc 100644 --- a/lib/Danga/Socket.pm +++ b/lib/Danga/Socket.pm @@ -139,6 +139,10 @@ use constant POLLERR => 8; use constant POLLHUP => 16; use constant POLLNVAL => 32; +# caching pack used by tcp_cork +use constant PACK_0 => pack("l", 0); +use constant PACK_1 => pack("l", 1); + our $HAVE_KQUEUE = eval { require IO::KQueue; 1 }; our ( @@ -813,7 +817,7 @@ sub tcp_cork { my $rv; if (TCP_CORK) { $rv = setsockopt($self->{sock}, IPPROTO_TCP, TCP_CORK, - pack("l", $val ? 1 : 0)); + $val ? PACK_0 : PACK_1); } else { # FIXME: implement freebsd *PUSH sockopts $rv = 1; -- 1.7.7.1
From: bitcard@miuku.net
On Wed 23.Nov 2011 13:39:01, nicolas.rochelemagne@cpanel.net wrote:
Show quoted text
> - pack("l", $val ? 1 : 0)); > + $val ? PACK_0 : PACK_1);
Please note that this patch would change 0 to 1 and vice versa. $val ? PACK_1 : PACK_0 would retain the previous behaviour.
The bug is fixed in https://cpan.metacpan.org/authors/id/N/NM/NML/Danga-Socket-1.62_03-TRIAL.tar.gz Please test and/or review the code. It's a preview version and I'll release normal 1.62 in a week or so if no new easy to fix problems are discovered. - CPAN Testers: http://matrix.cpantesters.org/?dist=Danga-Socket+1.62_03-TRIAL (all green at the time of the posting) - GitHub: https://github.com/nponeccop/libdanga-socket-perl/tree/windows-blocking


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.