mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-13 16:16:45 +00:00
Use IO::Socket::IP instead of INET
This commit is contained in:
parent
93276209cc
commit
00dc9d0fa9
@ -24,7 +24,7 @@ use PVE::INotify;
|
||||
use POSIX ":sys_wait_h";
|
||||
use Fcntl ':flock';
|
||||
use Socket qw(IPPROTO_TCP TCP_NODELAY SOMAXCONN);
|
||||
use IO::Socket::INET;
|
||||
use IO::Socket::IP;
|
||||
|
||||
use Getopt::Long;
|
||||
use Time::HiRes qw (gettimeofday);
|
||||
@ -795,13 +795,13 @@ sub create_reusable_socket {
|
||||
if $sockfd !~ m/^(\d+)$/;
|
||||
$sockfd = $1; # untaint
|
||||
|
||||
$socket = IO::Socket::INET->new;
|
||||
$socket = IO::Socket::IP->new;
|
||||
$socket->fdopen($sockfd, 'w') ||
|
||||
die "cannot fdopen file descriptor '$sockfd' - $!\n";
|
||||
|
||||
} else {
|
||||
|
||||
$socket = IO::Socket::INET->new(
|
||||
$socket = IO::Socket::IP->new(
|
||||
LocalAddr => $host,
|
||||
LocalPort => $port,
|
||||
Listen => SOMAXCONN,
|
||||
|
@ -3,7 +3,7 @@ package PVE::Tools;
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(EINTR);
|
||||
use IO::Socket::INET;
|
||||
use IO::Socket::IP;
|
||||
use IO::Select;
|
||||
use File::Basename;
|
||||
use File::Path qw(make_path);
|
||||
@ -691,11 +691,11 @@ sub next_unused_port {
|
||||
for (my $p = $range_start; $p < $range_end; $p++) {
|
||||
next if $ports->{$p}; # reserved
|
||||
|
||||
my $sock = IO::Socket::INET->new(Listen => 5,
|
||||
LocalAddr => '0.0.0.0',
|
||||
LocalPort => $p,
|
||||
ReuseAddr => 1,
|
||||
Proto => 0);
|
||||
my $sock = IO::Socket::IP->new(Listen => 5,
|
||||
LocalAddr => '0.0.0.0',
|
||||
LocalPort => $p,
|
||||
ReuseAddr => 1,
|
||||
Proto => 0);
|
||||
|
||||
if ($sock) {
|
||||
close($sock);
|
||||
|
Loading…
Reference in New Issue
Block a user