outbound_event_bookkeeping
is not implemented for Event::Sync
#6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There's a
todo!()
in the code inrelay.rs
that needs to be fixed.The purpose of
outbound_event_bookkeeping
is to update entity reference counts across the membranes of the active relay as events flow outward toward the peer.assert
increments the reference count on the wiresymbol denoting the target; refcount increments have already been done as part of encoding the packet for transmission.message
is transient, so doesn't increment the reference count on the target, and furthermore decrements the refcounts that the encoding process just incremented. If a refcount hits zero as part of this, that's an error, because the user just sent a transient reference.retract
decrements the increments made when the correspondingassert
happened; the encoding process of the packet holding theretract
doesn't change any refcounts itself, since it just carries a handle.sync
currently just callstodo!()
.So, what should it do?
assert
That's fairly straightforward-seeming. So why the
todo!()
rather than just implementing it? The problem, I think, is that there's nowhere to put the incref'd handle such that when the sync response comes in it gets released again.Other implementations usually supply a
SyncPeerEntity
thing which knows to drop both itself and the target entity from the membrane's indexes when a message comes in. In the Rust code, there's aSyncPeer
for the inbound side, so I think we need the symmetric outbound kind of proxy.Edited to add: Unfortunately by the time
outbound_event_bookkeeping
is called, the sync with the original, non-wrapped reply-continuation entity has already been encoded and transmitted. We need to wrap the entity ref with some kind ofSyncPeerEntity
before it gets transmitted.A good place to do all this would be in
impl Entity<AnyValue> for RelayEntity
. Perhaps it could do the necessary target incref, too, leaving the actual location of thetodo!()
a no-op.