Skip to content

Commit 7772e28

Browse files
committed
Merge remote-tracking branch 'origin/main' into leak-stacks
2 parents 4407051 + 63918f6 commit 7772e28

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rpc/answer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func errorAnswer(c *Conn, id answerID, err error) *answer {
9898
// newReturn creates a new Return message. The returned Releaser will release the message when
9999
// all references to it are dropped; the caller is responsible for one reference. This will not
100100
// happen before the message is sent, as the returned send function retains a reference.
101-
func (c *Conn) newReturn(ctx context.Context) (_ rpccp.Return, sendMsg func(), _ *rc.Releaser, _ error) {
101+
func (c *Conn) newReturn() (_ rpccp.Return, sendMsg func(), _ *rc.Releaser, _ error) {
102102
outMsg, err := c.transport.NewMessage()
103103
if err != nil {
104104
return rpccp.Return{}, nil, nil, rpcerr.Failedf("create return: %w", err)

rpc/rpc.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ type Conn struct {
7272
er errReporter
7373
abortTimeout time.Duration
7474

75-
// bgctx is a Context that is canceled when shutdown starts.
75+
// bgctx is a Context that is canceled when shutdown starts. Note
76+
// that it's parent is context.Background(), so we can rely on this
77+
// being the *only* time it will be canceled.
7678
bgctx context.Context
79+
7780
// tasks block shutdown.
7881
tasks sync.WaitGroup
7982
closed chan struct{} // closed when shutdown() returns
@@ -619,7 +622,7 @@ func (c *Conn) handleBootstrap(ctx context.Context, id answerID) error {
619622
)
620623

621624
syncutil.Without(&c.lk, func() {
622-
ans.ret, ans.sendMsg, ans.msgReleaser, err = c.newReturn(ctx)
625+
ans.ret, ans.sendMsg, ans.msgReleaser, err = c.newReturn()
623626
if err == nil {
624627
ans.ret.SetAnswerId(uint32(id))
625628
ans.ret.SetReleaseParamCaps(false)
@@ -694,7 +697,7 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
694697

695698
// Create return message.
696699
c.lk.Unlock()
697-
ret, send, retReleaser, err := c.newReturn(ctx)
700+
ret, send, retReleaser, err := c.newReturn()
698701
if err != nil {
699702
err = rpcerr.Annotate(err, "incoming call")
700703
syncutil.With(&c.lk, func() {

0 commit comments

Comments
 (0)