Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defend against nil-pointer panics in question.release #269

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions rpc/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (c *Conn) newQuestion(method capnp.Method) *question {
q := &question{
c: c,
id: questionID(c.questionID.next()),
release: func() {},
finishMsgSend: make(chan struct{}),
}
q.p = capnp.NewPromise(method, q) // TODO(someday): customize error message for bootstrap
Expand Down
3 changes: 0 additions & 3 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,6 @@ func (c *Conn) handleReturn(ctx context.Context, ret rpccp.Return, release capnp
go func() {
switch {
case q.bootstrapPromise != nil && pr.err == nil:
q.release = func() {}
syncutil.Without(&c.mu, func() {
q.p.Fulfill(pr.result)
q.bootstrapPromise.Fulfill(q.p.Answer().Client())
Expand All @@ -958,7 +957,6 @@ func (c *Conn) handleReturn(ctx context.Context, ret rpccp.Return, release capnp
case q.bootstrapPromise != nil && pr.err != nil:
// TODO(someday): send unimplemented message back to remote if
// pr.unimplemented == true.
q.release = func() {}
syncutil.Without(&c.mu, func() {
q.p.Reject(pr.err)
q.bootstrapPromise.Fulfill(q.p.Answer().Client())
Expand All @@ -968,7 +966,6 @@ func (c *Conn) handleReturn(ctx context.Context, ret rpccp.Return, release capnp
case q.bootstrapPromise == nil && pr.err != nil:
// TODO(someday): send unimplemented message back to remote if
// pr.unimplemented == true.
q.release = func() {}
syncutil.Without(&c.mu, func() {
q.p.Reject(pr.err)
release()
Expand Down