[Pkg-privacy-commits] [msva-perl] 321/356: Handle server restarts (SIGHUP) cleanly even with Net::Server 0.99
Ximin Luo
infinity0 at moszumanska.debian.org
Mon Aug 24 07:42:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository msva-perl.
commit ca912dd7da426f083100096a009ef5064479d45b
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date: Wed Apr 20 01:37:06 2011 -0400
Handle server restarts (SIGHUP) cleanly even with Net::Server 0.99
With Net::Server 0.97, the old code was working. With Net::Server
0.99, @{ $server->{server}->{sock} }[0]->sockport() was returning
undef() after a HUP.
The simple solution is that we don't try to re-set the port at all
after a SIGHUP.
---
Crypt/Monkeysphere/MSVA.pm | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm
index 6442fbb..fd3540b 100755
--- a/Crypt/Monkeysphere/MSVA.pm
+++ b/Crypt/Monkeysphere/MSVA.pm
@@ -764,18 +764,20 @@
$server->set_exit_status(10);
$server->server_close();
}
- my $port = @{ $server->{server}->{sock} }[0]->sockport();
- if ((! defined $port) || ($port < 1) || ($port >= 65536)) {
- msvalog('error', "got nonsense port: %d.\n", $port);
- $server->set_exit_status(11);
- $server->server_close();
- }
- if ((exists $ENV{MSVA_PORT}) && (($ENV{MSVA_PORT} + 0) != $port)) {
- msvalog('error', "Explicitly requested port %d, but got port: %d.", ($ENV{MSVA_PORT}+0), $port);
- $server->set_exit_status(13);
- $server->server_close();
+ if (!defined($self->port) || $self->port == 0) {
+ my $port = @{ $server->{server}->{sock} }[0]->sockport();
+ if ((! defined($port)) || ($port < 1) || ($port >= 65536)) {
+ msvalog('error', "got nonsense port: %d.\n", $port);
+ $server->set_exit_status(11);
+ $server->server_close();
+ }
+ if ((exists $ENV{MSVA_PORT}) && (($ENV{MSVA_PORT} + 0) != $port)) {
+ msvalog('error', "Explicitly requested port %d, but got port: %d.", ($ENV{MSVA_PORT}+0), $port);
+ $server->set_exit_status(13);
+ $server->server_close();
+ }
+ $self->port($port);
}
- $self->port($port);
$self->{updatemonitor} = Crypt::Monkeysphere::MSVA::Monitor::->new($logger);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/msva-perl.git
More information about the Pkg-privacy-commits
mailing list