Commit e1fb5ac8 authored by Dietmar Maurer's avatar Dietmar Maurer

spiceproxy: always restart unsing HUP

To keep existing spice connections alive.
parent 024514ee
......@@ -45,11 +45,6 @@ case "$1" in
$DAEMON stop
log_end_msg $?
;;
reload)
log_daemon_msg "Reloading $DESC" "$NAME"
$DAEMON reload
log_end_msg $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
$DAEMON restart
......
#!/usr/bin/perl -T
# Note: In theory, all this can be done by 'pveproxy' daemon. But som API call
# still have blocking code, so we use a separate daemon to avoid that the console
# get blocked.
# Note: In theory, all this can be done by 'pveproxy' daemon. But some
# API call still have blocking code, so we use a separate daemon to avoid
# that the console gets blocked.
$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
......@@ -64,7 +64,9 @@ sub init {
my ($socket, $sockfd);
if (defined($sockfd = $ENV{PVE_DAEMON_SOCKET_3128}) &&
my $port = 3128;
if (defined($sockfd = $ENV{"PVE_DAEMON_SOCKET_$port"}) &&
$self->{env_restart_pve_daemon}) {
die "unable to parse socket fd '$sockfd'\n"
......@@ -78,7 +80,7 @@ sub init {
} else {
$socket = IO::Socket::INET->new(
LocalAddr => undef, # all interfaces
LocalPort => 3128,
LocalPort => $port,
Listen => SOMAXCONN,
Proto => 'tcp',
ReuseAddr => 1) ||
......@@ -88,7 +90,7 @@ sub init {
# so we disable that to maximize performance
setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);
$ENV{PVE_DAEMON_SOCKET_3128} = $socket->fileno;
$ENV{"PVE_DAEMON_SOCKET_$port"} = $socket->fileno;
}
# remove FD_CLOEXEC bit to reuse on exec
......@@ -119,15 +121,13 @@ sub run {
}
$daemon->register_start_command();
$daemon->register_restart_command(0);
$daemon->register_reload_command();
$daemon->register_restart_command(1);
$daemon->register_stop_command();
$daemon->register_status_command();
my $cmddef = {
start => [ __PACKAGE__, 'start', []],
restart => [ __PACKAGE__, 'restart', []],
reload => [ __PACKAGE__, 'reload', []],
stop => [ __PACKAGE__, 'stop', []],
status => [ __PACKAGE__, 'status', [], undef, sub { print shift . "\n";} ],
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment