Skip to content

Commit

Permalink
localPromise.Fulfill: steal argument
Browse files Browse the repository at this point in the history
  • Loading branch information
zenhack committed Jun 22, 2023
1 parent 51facf7 commit 4f8d2d8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestResolve(t *testing.T) {
}
t.Run("Clients", func(t *testing.T) {
test(t, "Waits for the full chain", func(t *testing.T, p1, p2 Client, r1, r2 Resolver[Client]) {
r1.Fulfill(p2)
r1.Fulfill(p2.AddRef())
ctx, cancel := context.WithTimeout(context.Background(), time.Second/10)
defer cancel()
require.NotNil(t, p1.Resolve(ctx), "blocks on second promise")
Expand Down
1 change: 1 addition & 0 deletions localpromise.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func (lf localResolver[C]) Fulfill(c C) {
iface := NewInterface(seg, capID)
lf.p.Fulfill(iface.ToPtr())
lf.p.ReleaseClients()
msg.Release()
}

func (lf localResolver[C]) Reject(err error) {
Expand Down
4 changes: 1 addition & 3 deletions rpc/senderpromise_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,7 @@ func TestPromiseOrdering(t *testing.T) {
// with the other bootstrap interface:
if i == 100 {
go func() {
bs := testcapnp.PingPong(c1.Bootstrap(ctx))
defer bs.Release()
r.Fulfill(bs)
r.Fulfill(testcapnp.PingPong(c1.Bootstrap(ctx)))
}()
}
}
Expand Down

0 comments on commit 4f8d2d8

Please sign in to comment.