(ctx context.Context)
| 556 | } |
| 557 | |
| 558 | func (handler *RpcRequestHandler) SendCancel(ctx context.Context) error { |
| 559 | defer func() { |
| 560 | panichandler.PanicHandler("SendCancel", recover()) |
| 561 | }() |
| 562 | msg := &RpcMessage{ |
| 563 | Cancel: true, |
| 564 | ReqId: handler.reqId, |
| 565 | } |
| 566 | barr, _ := json.Marshal(msg) // will never fail |
| 567 | select { |
| 568 | case handler.w.OutputCh <- barr: |
| 569 | handler.finalize() |
| 570 | return nil |
| 571 | case <-ctx.Done(): |
| 572 | handler.finalize() |
| 573 | return fmt.Errorf("timeout sending cancel") |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | func (handler *RpcRequestHandler) ResponseDone() bool { |
| 578 | if handler.cachedResp != nil { |
no test coverage detected