Skip to content

Commit ede881f

Browse files
committed
5.15.9 - Add stop sig bypass
1 parent 16097f0 commit ede881f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

runtimepy/net/arbiter/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,10 @@ async def _init_connections(self) -> None:
237237
self._register_connection(value, key)
238238

239239
# Ensure connections are all initialized.
240-
await _asyncio.gather(
241-
*(x.initialized.wait() for x in self._connections.values())
242-
)
240+
with self.log_time("Connection initialization", reminder=True):
241+
await _asyncio.gather(
242+
*(x.initialized.wait() for x in self._connections.values())
243+
)
243244

244245
async def _build_structs(self, info: AppInfo) -> None:
245246
"""Build structs."""
@@ -372,6 +373,8 @@ async def _entry(
372373
info: Optional[AppInfo] = None
373374

374375
try:
376+
self.stop_sig.clear()
377+
375378
async with _AsyncExitStack() as stack:
376379
result, info = await self._main(
377380
stack,

runtimepy/net/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Connection(
4343
byte_order: ByteOrder = DEFAULT_BYTE_ORDER
4444

4545
default_auto_restart = False
46+
ignore_stop_sig = False
4647

4748
def __init__(
4849
self,
@@ -300,7 +301,7 @@ async def process(
300301
)
301302

302303
# Allow a stop signal to also disable the connection.
303-
if stop_sig is not None:
304+
if stop_sig is not None and not self.ignore_stop_sig:
304305
self._tasks.append(_asyncio.create_task(self._wait_sig(stop_sig)))
305306

306307
self.exited.clear()

runtimepy/net/manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ async def manage(self, stop_sig: _asyncio.Event) -> None:
122122
tasks = next_tasks
123123

124124
with self.log_time("Shutting down", reminder=True):
125+
for conn in self._conns:
126+
conn.disable("connection manager shutdown")
127+
125128
# Allow existing tasks to clean up.
126129
if new_conn_task is not None:
127130
new_conn_task.cancel()

0 commit comments

Comments
 (0)