spiceproxy: use new helpers from PVE::Daemon
This commit is contained in:
parent
471ddcf91e
commit
50c4c9170b
@ -33,7 +33,7 @@ $SIG{'__WARN__'} = sub {
|
||||
my $cmdline = [$0, @ARGV];
|
||||
|
||||
my %daemon_options = (
|
||||
max_workers => 1, # fixme: do we need more?
|
||||
max_workers => 1, # todo: do we need more?
|
||||
restart_on_error => 5,
|
||||
stop_wait_time => 15,
|
||||
leave_children_open_on_reload => 1,
|
||||
@ -62,39 +62,7 @@ sub init {
|
||||
my $lockfh = IO::File->new(">>${accept_lock_fn}") ||
|
||||
die "unable to open lock file '${accept_lock_fn}' - $!\n";
|
||||
|
||||
my ($socket, $sockfd);
|
||||
|
||||
my $port = 3128;
|
||||
|
||||
if (defined($sockfd = $ENV{"PVE_DAEMON_SOCKET_$port"}) &&
|
||||
$self->{env_restart_pve_daemon}) {
|
||||
|
||||
die "unable to parse socket fd '$sockfd'\n"
|
||||
if $sockfd !~ m/^(\d+)$/;
|
||||
$sockfd = $1; # untaint
|
||||
|
||||
$socket = IO::Socket::INET->new;
|
||||
$socket->fdopen($sockfd, 'w') ||
|
||||
die "cannot fdopen file descriptor '$sockfd' - $!\n";
|
||||
|
||||
} else {
|
||||
$socket = IO::Socket::INET->new(
|
||||
LocalAddr => undef, # all interfaces
|
||||
LocalPort => $port,
|
||||
Listen => SOMAXCONN,
|
||||
Proto => 'tcp',
|
||||
ReuseAddr => 1) ||
|
||||
die "unable to create socket - $@\n";
|
||||
|
||||
# we often observe delays when using Nagle algorithm,
|
||||
# so we disable that to maximize performance
|
||||
setsockopt($socket, IPPROTO_TCP, TCP_NODELAY, 1);
|
||||
|
||||
$ENV{"PVE_DAEMON_SOCKET_$port"} = $socket->fileno;
|
||||
}
|
||||
|
||||
# remove FD_CLOEXEC bit to reuse on exec
|
||||
$socket->fcntl(Fcntl::F_SETFD(), 0);
|
||||
my $socket = $self->create_reusable_socket(3128);
|
||||
|
||||
$self->{server_config} = {
|
||||
base_handler_class => 'PVE::API2',
|
||||
|
Loading…
x
Reference in New Issue
Block a user