From 5b1db5c816ab97b567a0a97c0ed1f4796c42f129 Mon Sep 17 00:00:00 2001 From: Ian Denhardt Date: Fri, 27 Jan 2023 23:47:22 -0500 Subject: [PATCH] Define .cancelTasks() on lockedConn instead of Conn. Similar to the recent patch involving findEmbargo --- rpc/rpc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/rpc.go b/rpc/rpc.go index e29ba42b..075d3444 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -369,7 +369,7 @@ func (c *Conn) Done() <-chan struct{} { func (c *Conn) shutdown(abortErr error) (err error) { alreadyClosing := false - syncutil.With(&c.lk, func() { + c.withLocked(func(c *lockedConn) { alreadyClosing = c.lk.closing if !alreadyClosing { c.lk.closing = true @@ -410,7 +410,7 @@ func (c *Conn) shutdown(abortErr error) (err error) { // Cancel all tasks and prevent new tasks from being started. // Does not wait for tasks to finish shutting down. // Called by 'shutdown'. Callers MUST hold c.lk. -func (c *Conn) cancelTasks() { +func (c *lockedConn) cancelTasks() { for _, a := range c.lk.answers { if a != nil && a.cancel != nil { a.cancel()