fix(tools): make target optional when using external parent in manage tunnel

main
Tsu-ba-me 1 year ago committed by digimer
parent 4bdd206e0c
commit db06747513
  1. 21
      tools/anvil-manage-tunnel

@ -220,17 +220,24 @@ sub open_connection
$anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => $parameters, prefix => "open_connection" }); $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => $parameters, prefix => "open_connection" });
if ($external_parent)
{
# Control socket path must exist if we want to use an
# external parent connection.
return (1) if ( (not defined $ctl_path) || (not -e $ctl_path) );
$target //= "0.0.0.0";
}
else
{
return (1) if ( (not defined $target) || ($target eq "") ); return (1) if ( (not defined $target) || ($target eq "") );
if (defined $ctl_path) if (defined $ctl_path)
{ {
# 1. Control socket path must exist if we want to use an # Control socket path mustn't exist if we want to
# external parent connection. # establish a new parent connection with it.
# 2. Control socket path mustn't exist if we want to establish return (1) if ( ($ctl_path eq "") || (-e $ctl_path) );
# a new parent connection. }
return (1) if ( ($ctl_path eq "")
|| ( $external_parent && (not -e $ctl_path) )
|| ( (not $external_parent) && (-e $ctl_path) ) );
} }
my ($output, $error, $rcode) = $anvil->Remote->call({ my ($output, $error, $rcode) = $anvil->Remote->call({

Loading…
Cancel
Save