MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / SendCancel

Method SendCancel

pkg/wshutil/wshrpc.go:558–575  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

556}
557
558func (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
577func (handler *RpcRequestHandler) ResponseDone() bool {
578 if handler.cachedResp != nil {

Callers 1

Calls 2

finalizeMethod · 0.95
PanicHandlerFunction · 0.92

Tested by

no test coverage detected