Decouple registery addresses from binding addresses

pull/4/head
Jad Abou-Chakra 2024-09-19 18:17:20 +10:00
parent 1858fb6efc
commit aba46b723b
1 changed files with 6 additions and 8 deletions

View File

@ -70,6 +70,9 @@ async def open_root_actor(
# defaults are above # defaults are above
arbiter_addr: tuple[str, int]|None = None, arbiter_addr: tuple[str, int]|None = None,
# binding addrs for the transport layer server
trans_bind_addrs: list[tuple[str, int]] = [(_default_host, _default_port)],
name: str|None = 'root', name: str|None = 'root',
# either the `multiprocessing` start method: # either the `multiprocessing` start method:
@ -184,6 +187,8 @@ async def open_root_actor(
) )
assert registry_addrs assert registry_addrs
assert trans_bind_addrs
loglevel = ( loglevel = (
loglevel loglevel
or log._default_loglevel or log._default_loglevel
@ -273,8 +278,6 @@ async def open_root_actor(
tuple(addr), # TODO: just drop this requirement? tuple(addr), # TODO: just drop this requirement?
) )
trans_bind_addrs: list[tuple[str, int]] = []
# Create a new local root-actor instance which IS NOT THE # Create a new local root-actor instance which IS NOT THE
# REGISTRAR # REGISTRAR
if ponged_addrs: if ponged_addrs:
@ -296,11 +299,6 @@ async def open_root_actor(
loglevel=loglevel, loglevel=loglevel,
enable_modules=enable_modules, enable_modules=enable_modules,
) )
# DO NOT use the registry_addrs as the transport server
# addrs for this new non-registar, root-actor.
for host, port in ponged_addrs:
# NOTE: zero triggers dynamic OS port allocation
trans_bind_addrs.append((host, 0))
# Start this local actor as the "registrar", aka a regular # Start this local actor as the "registrar", aka a regular
# actor who manages the local registry of "mailboxes" of # actor who manages the local registry of "mailboxes" of