Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
440e96a
clientPromise.fulfill: use a deferred.Queue
zenhack Apr 27, 2023
a05ef33
Merge branch 'remove-wc.h-fixme' into rc-pkg
zenhack Apr 27, 2023
2b31fa2
Move the responsibility for resolveHook onto a new type
zenhack Apr 27, 2023
86e7e4a
Factor clientHook deref into its own function.
zenhack Apr 27, 2023
d467d17
Merge branch 'peek-return-order' into rc-pkg
zenhack Apr 28, 2023
a6a1e7e
WIP: rework internal refcounting in clients.
zenhack Apr 29, 2023
8cd3269
resolveHook: fiddle with refcounts as we walk down the chain.
zenhack Apr 29, 2023
d42f6fb
dummyHook: show a bit more info in String()
zenhack Apr 29, 2023
1bc69d8
More info in test error message
zenhack Apr 29, 2023
e2d067e
clientPromise.fulfill: don't release the argument.
zenhack Apr 29, 2023
1e0fdb0
Delete commented out code.
zenhack Apr 29, 2023
888eece
Fix leak in WeakClient.AddRef()
zenhack Apr 29, 2023
aa2bf27
Fix incorrect comment.
zenhack Apr 29, 2023
84cf90e
Remember to set released flag in Client.Release
zenhack Apr 29, 2023
404ca44
Fix bogus duplicate call to newClientCursor()
zenhack May 9, 2023
ace3d48
clientHook: release resolution when released.
zenhack May 9, 2023
8e19242
Simplify the contract for resolveHook.
zenhack May 11, 2023
21e36c0
Cleanup the structure of resolution state.
zenhack May 11, 2023
a70c592
Remove superfluous resolveHook helper.
zenhack May 11, 2023
7fbf9c3
Merge remote-tracking branch 'origin/main' into rc-pkg
zenhack May 11, 2023
88d3b1e
Merge remote-tracking branch 'origin/main' into rc-pkg
zenhack May 11, 2023
4bd6405
Bump go-util version
zenhack May 11, 2023
27ae512
Factor out release logic for clientHook
zenhack May 12, 2023
39f9e3d
Delete a done TODO
zenhack May 12, 2023
9da2ba2
Client.IsSame: remove duplicate calls to IsValid()
zenhack May 14, 2023
7970dd8
Remove unnecessary indirection for WeakClient.
zenhack May 14, 2023
e0d6e81
Slightly refactor clientCursor.
zenhack May 14, 2023
99c0b23
Remember to release promise clients in answer entries.
zenhack May 16, 2023
ca34bde
Fix typo in test name
zenhack May 16, 2023
9b715d0
Change test to match new WeakRef semantics.
zenhack May 24, 2023
722c2a7
Merge remote-tracking branch 'origin/main' into rc-pkg
zenhack May 24, 2023
ad58550
Revert change to resolved check in Client.Resolve
zenhack May 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions answer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"capnproto.org/go/capnp/v3/exc"
"capnproto.org/go/capnp/v3/internal/str"
"zenhack.net/go/util/deferred"
"zenhack.net/go/util/sync/mutex"
)

Expand Down Expand Up @@ -135,7 +136,8 @@ func (p *Promise) Reject(e error) {
// If e != nil, then this is equivalent to p.Reject(e).
// Otherwise, it is equivalent to p.Fulfill(r).
func (p *Promise) Resolve(r Ptr, e error) {
var shutdownPromises []*clientPromise
dq := &deferred.Queue{}
defer dq.Run()

// It's ok to extract p.clients and use it while not holding the lock:
// it may not be accessed in the pending resolution state, so we have
Expand All @@ -155,8 +157,7 @@ func (p *Promise) Resolve(r Ptr, e error) {
res := resolution{p.method, r, e}
for path, cp := range clients {
t := path.transform()
cp.promise.fulfill(res.client(t))
shutdownPromises = append(shutdownPromises, cp.promise)
cp.promise.fulfill(dq, res.client(t))
cp.promise = nil
}

Expand All @@ -168,9 +169,6 @@ func (p *Promise) Resolve(r Ptr, e error) {
}
p.signals = nil
})
for _, promise := range shutdownPromises {
promise.shutdown()
}
}

// requireUnresolved is a helper method for checking for duplicate
Expand Down
Loading