Skip to content

Commit ec0ba56

Browse files
committed
jsonrpc2: implements Conn.Cancel method
1 parent ca8f6a3 commit ec0ba56

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

jsonrpc2.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,13 @@ func (c *Conn) Notify(ctx context.Context, method string, params interface{}) er
288288
}
289289

290290
// Cancel cancels a pending Call on the server side.
291-
func (c *Conn) Cancel(id ID) {}
291+
func (c *Conn) Cancel(id ID) {
292+
m := c.handling.Load().(handlingMap)
293+
handling, found := m[id]
294+
if found {
295+
handling.cancel()
296+
}
297+
}
292298

293299
// Run run the jsonrpc2 server.
294300
func (c *Conn) Run(ctx context.Context) error { return nil }

0 commit comments

Comments
 (0)