jsonrpc: Correctly cancel server-side contexts on lost connection

This commit is contained in:
Łukasz Magiera 2020-05-01 21:50:34 +02:00
parent 971282a9a5
commit 4014cbdb44

View File

@ -436,13 +436,14 @@ func (c *wsConn) closeInFlight() {
Code: 2, Code: 2,
}, },
} }
}
c.handlingLk.Lock() c.handlingLk.Lock()
for _, cancel := range c.handling { for _, cancel := range c.handling {
cancel() cancel()
} }
c.handlingLk.Unlock() c.handlingLk.Unlock()
}
c.inflight = map[int64]clientRequest{} c.inflight = map[int64]clientRequest{}
c.handling = map[int64]context.CancelFunc{} c.handling = map[int64]context.CancelFunc{}
} }