relays: create fresh dataspace at stdin relay
This commit is contained in:
parent
a014362292
commit
8ef95c0e1d
|
@ -323,6 +323,7 @@ when defined(posix):
|
|||
|
||||
proc connectTransport(turn: var Turn; ds: Cap; ta: transportAddress.Stdio) =
|
||||
## Connect to an external dataspace over stdio.
|
||||
let localDataspace = newDataspace(turn)
|
||||
proc stdoutWriter(turn: var Turn; buf: seq[byte]) =
|
||||
## Blocking write to stdout.
|
||||
let n = writeBytes(stdout, buf, 0, buf.len)
|
||||
|
@ -331,7 +332,7 @@ when defined(posix):
|
|||
stopActor(turn)
|
||||
var opts = RelayActorOptions(
|
||||
packetWriter: stdoutWriter,
|
||||
initialCap: ds,
|
||||
initialCap: localDataspace,
|
||||
initialOid: 0.Oid.some,
|
||||
)
|
||||
spawnRelay("stdio", turn, opts) do (turn: var Turn; relay: Relay):
|
||||
|
@ -351,7 +352,7 @@ when defined(posix):
|
|||
publish(turn, ds, TransportConnection(
|
||||
`addr`: ta.toPreserves,
|
||||
control: newCap(entity, turn),
|
||||
resolved: relay.peer.accepted,
|
||||
resolved: localDataspace.accepted,
|
||||
))
|
||||
|
||||
proc connectStdio*(turn: var Turn; ds: Cap) =
|
||||
|
|
Loading…
Reference in New Issue