[Pkg-privacy-commits] [msva-perl] 164/356: allow clean re-exec for smoother upgrades (closes MS #2532)

Ximin Luo infinity0 at moszumanska.debian.org
Mon Aug 24 07:41:52 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 c63a9f91248b1b00ec2223805d83da1e1d37945d
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Tue Oct 12 03:46:08 2010 -0400

    allow clean re-exec for smoother upgrades (closes MS #2532)
---
 Changelog                  | 4 ++++
 Crypt/Monkeysphere/MSVA.pm | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index d885931..b4add1a 100644
--- a/Changelog
+++ b/Changelog
@@ -7,6 +7,10 @@ msva-perl (0.5~pre) unstable; urgency=low
   * Conditionally rely on Gtk2 perl module -- no marginal UI without it,
     but you can also install the MSVA now without needing to pull in a
     bunch of Gtk libs (closes MS #2514)
+  * Sending a SIGHUP to the running server now re-execs it cleanly,
+    keeping the same port assignments and monitoring the same child
+    process.  This can be used to upgrade running msva instances after a
+    package update (closes MS #2532)
 
  -- Daniel Kahn Gillmor <dkg at fifthhorseman.net>  Mon, 11 Oct 2010 16:02:22 -0400
 
diff --git a/Crypt/Monkeysphere/MSVA.pm b/Crypt/Monkeysphere/MSVA.pm
index e620a4c..d4c5852 100755
--- a/Crypt/Monkeysphere/MSVA.pm
+++ b/Crypt/Monkeysphere/MSVA.pm
@@ -666,8 +666,11 @@
     }
     $self->port($port);
 
-    my $argcount = @ARGV;
-    if ($argcount) {
+    if ((exists $ENV{MSVA_CHILD_PID}) && ($ENV{MSVA_CHILD_PID} ne '')) {
+      # this is most likely a re-exec.
+      msvalog('info', "This appears to be a re-exec, monitoring child pid %d\n", $ENV{MSVA_CHILD_PID});
+      $self->{child_pid} = $ENV{MSVA_CHILD_PID} + 0;
+    } elsif ($#ARGV >= 0) {
       $self->{child_pid} = 0; # indicate that we are planning to fork.
       my $fork = fork();
       if (! defined $fork) {
@@ -676,6 +679,7 @@
         if ($fork) {
           msvalog('debug', "Child process has PID %d\n", $fork);
           $self->{child_pid} = $fork;
+          $ENV{MSVA_CHILD_PID} = $fork;
         } else {
           msvalog('verbose', "PID %d executing: \n", $$);
           for my $arg (@ARGV) {

-- 
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