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. 25
      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" });
return (1) if ( (not defined $target) || ($target eq "") ); 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) );
if (defined $ctl_path) $target //= "0.0.0.0";
}
else
{ {
# 1. Control socket path must exist if we want to use an return (1) if ( (not defined $target) || ($target eq "") );
# external parent connection.
# 2. Control socket path mustn't exist if we want to establish if (defined $ctl_path)
# a new parent connection. {
return (1) if ( ($ctl_path eq "") # Control socket path mustn't exist if we want to
|| ( $external_parent && (not -e $ctl_path) ) # establish a new parent connection with it.
|| ( (not $external_parent) && (-e $ctl_path) ) ); return (1) if ( ($ctl_path eq "") || (-e $ctl_path) );
}
} }
my ($output, $error, $rcode) = $anvil->Remote->call({ my ($output, $error, $rcode) = $anvil->Remote->call({

Loading…
Cancel
Save