AnyEvent::Socket::getprotobyname()

gleeco gleeco at gmail.com
Tue Feb 15 07:10:37 CET 2011


was seeing repeated calls to mmap the file /etc/protocols ( --once for
every AnyEvent::HTTP::request!) and looking a bit deeper, it looks
like the test for inclusion of the $PROTO_BYNAME{tcp} short-circuit is
not firing (at least on my platform: centOS 5.3, perl 5.8.8; AnyEvent
5.3).  Purr-haps you've seen how these constant-ish ops work whilst
digging in to the Socket internals?

here's patch/test to AnyEvent::Socket v.5.3:

221c221
< $PROTO_BYNAME{tcp}  = Socket::IPPROTO_TCP () if defined &Socket::IPPROTO_TCP;
---
> $PROTO_BYNAME{tcp}  = Socket::IPPROTO_TCP () if defined Socket::IPPROTO_TCP;
227a228,229
> warn __PACKAGE__ , " getprotobyname($name) called\t", ((exists  $PROTO_BYNAME{$name}) ? "TRUE" : "FALSE" ), "\n";



-- 

-gleeco



More information about the anyevent mailing list