[pve-devel] [PATCH 1/2] pass extra args in next_unused_port functions to IP->new

Dietmar Maurer dietmar at proxmox.com
Tue May 12 06:49:38 CEST 2015


I normally try to keep interfaces as small as possible, so I wonder if
it is really necessary to pass that 'args' array? What if we simply
pass a 'family' argument?

sub next_unused_port {
    my ($range_start, $range_end, $family) = @_;


>  sub next_unused_port {
> -    my ($range_start, $range_end) = @_;
> +    my ($range_start, $range_end, @args) = @_;
>  
>      # We use a file to register allocated ports.
>      # Those registrations expires after $expiretime.
> @@ -693,10 +693,10 @@ sub next_unused_port {
>  	    next if $ports->{$p}; # reserved
>  
>  	    my $sock = IO::Socket::IP->new(Listen => 5,
> -					   LocalAddr => '0.0.0.0',
>  					   LocalPort => $p,
>  					   ReuseAddr => 1,
> -					   Proto     => 0);
> +					   Proto     => 0,
> +					   @args);




More information about the pve-devel mailing list