relays: resolve environment once

This commit is contained in:
Emery Hemingway 2024-03-15 10:21:02 +00:00
parent 50b00827ce
commit 76acf2cb67
1 changed files with 6 additions and 1 deletions

View File

@ -561,11 +561,16 @@ proc resolve*(turn: var Turn; ds: Cap; route: Route; bootProc: BootProc) =
proc resolveEnvironment*(turn: var Turn; bootProc: BootProc) =
## Resolve a capability from the calling environment
## and call `bootProc`. See envRoute_.
var resolved = false
let
ds = newDataspace(turn)
pat = ResolvePath ?: {0: ?envRoute(), 3: ?:ResolvedAccepted}
during(turn, ds, pat) do (dst: Cap):
bootProc(turn, dst)
if not resolved:
resolved = true
bootProc(turn, dst)
do:
resolved = false
spawnRelays(turn, ds)
# TODO: define a runActor that comes preloaded with relaying