Bug-Typo Fix: interface_name changed to interface to match the other singbox module
This commit is contained in:
parent
ff54373b0f
commit
24c4648054
2 changed files with 5 additions and 5 deletions
|
|
@ -150,19 +150,19 @@ def _try_known_pid_from_state(current_state: Optional[SystemState]) -> Result:
|
|||
return _shut_down_by_known_process_id(cast(int, pid_query.data))
|
||||
|
||||
|
||||
def orchestrate_closing(current_state: SystemState, interface_name: str) -> Result:
|
||||
def orchestrate_closing(current_state: SystemState, interface: str) -> Result:
|
||||
strategies = [
|
||||
lambda: _try_known_pid_from_state(current_state),
|
||||
lambda: _try_shutdown_by_exact_match(),
|
||||
lambda: _hunt_and_kill(interface_name),
|
||||
lambda: _hunt_and_kill(interface),
|
||||
]
|
||||
quantity_of_strategies = len(strategies)
|
||||
|
||||
for strategy in strategies:
|
||||
result = _try_with_permission_fallback(strategy, interface_name)
|
||||
result = _try_with_permission_fallback(strategy, interface)
|
||||
if result.valid:
|
||||
return result
|
||||
if not interface_tools.exists(interface_name):
|
||||
if not interface_tools.exists(interface):
|
||||
return Result(valid=True, message="Tunnel inactive despite strategy failure")
|
||||
|
||||
return Result(valid=False, message=f"All {quantity_of_strategies} strategies tried, we simply can not bring down the proxy, which is still up.")
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ def end_singbox() -> Result:
|
|||
try:
|
||||
killed_existing = orchestrate_closing(
|
||||
current_state=current_state,
|
||||
interface_name=Constants.SINGBOX_TUN_IF
|
||||
interface=Constants.SINGBOX_TUN_IF
|
||||
)
|
||||
except RuntimeError as e: # Interface error raised by process_closure_tool's interface_exists
|
||||
return Result(valid=False, error_type=ResultError.INTERFACE, message=str(e))
|
||||
|
|
|
|||
Loading…
Reference in a new issue