Skip to content

Commit

Permalink
Merge pull request #309 from zenhack/kill-clearCapTable
Browse files Browse the repository at this point in the history
Delete clearCapTable()
  • Loading branch information
zenhack authored Sep 30, 2022
2 parents 9aab131 + 8063ad8 commit 502336b
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
c.answers[id] = errorAnswer(c, id, err)
})
c.er.ReportError(err)
clearCapTable(call.Message())
releaseCall()
return nil
}
Expand All @@ -675,7 +674,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
c.mu.Unlock()
c.er.ReportError(parseErr)
rl.release()
clearCapTable(call.Message())
releaseCall()
return nil
}
Expand All @@ -685,7 +683,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
return
}
released = true
clearCapTable(call.Message())
releaseCall()
}
switch p.target.which {
Expand All @@ -697,7 +694,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
ans.releaseMsg = nil
c.mu.Unlock()
releaseRet()
clearCapTable(call.Message())
releaseCall()
return rpcerr.Failedf("incoming call: unknown export ID %d", id)
}
Expand All @@ -724,7 +720,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
ans.releaseMsg = nil
c.mu.Unlock()
releaseRet()
clearCapTable(call.Message())
releaseCall()
return rpcerr.Failedf("incoming call: use of unknown or finished answer ID %d for promised answer target", p.target.promisedAnswer)
}
Expand All @@ -734,7 +729,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
rl := ans.sendException(tgtAns.err)
c.mu.Unlock()
rl.release()
clearCapTable(call.Message())
releaseCall()
return nil
}
Expand All @@ -748,7 +742,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
rl := ans.sendException(err)
c.mu.Unlock()
rl.release()
clearCapTable(call.Message())
releaseCall()
c.er.ReportError(err)
return nil
Expand All @@ -759,7 +752,6 @@ func (c *Conn) handleCall(ctx context.Context, call rpccp.Call, releaseCall capn
rl := ans.sendException(err)
c.mu.Unlock()
rl.release()
clearCapTable(call.Message())
releaseCall()
return nil
}
Expand Down Expand Up @@ -951,7 +943,6 @@ func (c *Conn) handleReturn(ctx context.Context, ret rpccp.Return, release capnp
q.p.Fulfill(pr.result)
q.bootstrapPromise.Fulfill(q.p.Answer().Client())
q.p.ReleaseClients()
clearCapTable(pr.result.Message())
release()
})
case q.bootstrapPromise != nil && pr.err != nil:
Expand All @@ -971,11 +962,7 @@ func (c *Conn) handleReturn(ctx context.Context, ret rpccp.Return, release capnp
release()
})
default:
m := ret.Message()
q.release = func() {
clearCapTable(m)
release()
}
q.release = release
syncutil.Without(&c.mu, func() {
q.p.Fulfill(pr.result)
})
Expand Down Expand Up @@ -1509,8 +1496,3 @@ func (as asyncSend) Send() {
as.callback(err)
}
}

func clearCapTable(msg *capnp.Message) {
releaseList(msg.CapTable).release()
msg.CapTable = nil
}

0 comments on commit 502336b

Please sign in to comment.