Skip to content

Conversation

@zenhack
Copy link
Contributor

@zenhack zenhack commented Apr 27, 2023

Stacked on top of #508, just the last commit is relevant.


Currently, non-promises are represented by clientHooks whose resolevedHook points back the same clientHook.

I want to move these over to the rc package from go-util, but having object cycles like this is going to cause problems. Instead, we just keep track of whether this was a promise in the first place more explicitly: wrap resolvedHook in a Maybe, where absent means this was
never a promise.

We could use a boolean flag here, but this is more type safe.

zenhack added 6 commits April 11, 2023 22:44
...because fewer special cases are better. This also resolves everything
but the documentation for capnproto#423.

One of the tests had to be reworked a bit because the exact sequence of
messages was a bit different, but still correct.
Per Louis's questions.
This will simplify transitioning to using the rc package for
refcounting.

Right now there is a bug where one of the tests is failing with an error
about multiple shutdowns -- I think this is likely equivalent to capnproto#348
(the done channel is gone), but it seems to be deterministic now.
This Shutdown() is redundant with the one in clientPromise.shutdown().
When capnproto#348 was filed, this was a close() on the done channel instead of a
call to ClientHook.Shutdown, but became the latter after merging
calls and refs -- done was for the former, Shutdown() for the latter.

I'm still not 100% sure why this used to be non-deterministic.
Currently, non-promises are represented by clientHooks whose
resolevedHook points back the same clientHook.

I want to move these over to the rc package from go-util, but having
object cycles like this is going to cause problems. Instead, we just
keep track of whether this was a promise in the first place more
explicitly: wrap resolvedHook in a Maybe, where absent means this was
never a promise.

We could use a boolean flag here, but this is more type safe.
@zenhack zenhack merged commit 9634d63 into capnproto:main May 24, 2023
@zenhack zenhack deleted the no-cycle branch May 24, 2023 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants