Register for signals only when running in main thread (#1087)
This commit is contained in:
parent
dc15dc1075
commit
0629fc43e9
|
@ -14,6 +14,7 @@ import time
|
||||||
import pprint
|
import pprint
|
||||||
import signal
|
import signal
|
||||||
import logging
|
import logging
|
||||||
|
import threading
|
||||||
from typing import TYPE_CHECKING, Any, List, Optional, cast
|
from typing import TYPE_CHECKING, Any, List, Optional, cast
|
||||||
|
|
||||||
from .core.ssh import SshTunnelListener, SshHttpProtocolHandler
|
from .core.ssh import SshTunnelListener, SshHttpProtocolHandler
|
||||||
|
@ -255,6 +256,7 @@ class Proxy:
|
||||||
('', self.flags.tunnel_remote_port),
|
('', self.flags.tunnel_remote_port),
|
||||||
)
|
)
|
||||||
# TODO: May be close listener fd as we don't need it now
|
# TODO: May be close listener fd as we don't need it now
|
||||||
|
if threading.current_thread() == threading.main_thread():
|
||||||
self._register_signals()
|
self._register_signals()
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
def shutdown(self) -> None:
|
||||||
|
|
Loading…
Reference in New Issue