Bug#624500: [rt.cpan.org #72357] [PATCH] propagate Net::Server's port information across a HUP

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Mar 16 00:52:40 UTC 2012


tags 624500 + patch
thanks

Thanks to intrigeri's very helpful investigation and explanation, I
sorted out what is going on with Net::Server when it uses
a dynamically-assigned port and undergoes a HUP.

The test for socket reconnection fails because the server knows it
initially requested port 0, but the actual socket has the OS-assigned
port associated with it.  So Net::Server compares the intended/requested
hup_string (e.g. "*|0|TCP") against the already-bound socket's hup_string
(e.g. "*|32633|TCP") and decides that they don't match.

The fix is to look at the already-bound hup_string and construct what it
would look like had it been the result of a dynamic request (replace the
port number with 0), and accept that as a match against the requested
hup_string as well.

Also, to ensure that NS_port is set properly after a HUP when using
dynamic port allocation, we propagate that info in
Net::Server::Proto::TCP->reconnect() in the same way it is propagated in
Net::Server::Proto::TCP->connect().

This appears to resolve the issue.

        --dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 08_propagate-dynamic-port-data-across-a-hup.patch
Type: text/x-diff
Size: 1449 bytes
Desc: propagate dynamic port information across a HUP
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120315/0fa3b6b6/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 965 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20120315/0fa3b6b6/attachment.pgp>


More information about the pkg-perl-maintainers mailing list