closeRequestOps unblocks pending send ops and active subscriptions.
(err error)
| 608 | |
| 609 | // closeRequestOps unblocks pending send ops and active subscriptions. |
| 610 | func (c *Client) closeRequestOps(err error) { |
| 611 | didClose := make(map[*requestOp]bool) |
| 612 | |
| 613 | for id, op := range c.respWait { |
| 614 | // Remove the op so that later calls will not close op.resp again. |
| 615 | delete(c.respWait, id) |
| 616 | |
| 617 | if !didClose[op] { |
| 618 | op.err = err |
| 619 | close(op.resp) |
| 620 | didClose[op] = true |
| 621 | } |
| 622 | } |
| 623 | for id, sub := range c.subs { |
| 624 | delete(c.subs, id) |
| 625 | sub.quitWithError(err, false) |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | func (c *Client) handleNotification(msg *jsonrpcMessage) { |
| 630 | if !strings.HasSuffix(msg.Method, notificationMethodSuffix) { |