(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)
| 22684 | } |
| 22685 | |
| 22686 | func (p *iClientRPCServiceProcessorCloseOperation) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { |
| 22687 | args := IClientRPCServiceCloseOperationArgs{} |
| 22688 | var err2 error |
| 22689 | if err2 = args.Read(ctx, iprot); err2 != nil { |
| 22690 | iprot.ReadMessageEnd(ctx) |
| 22691 | x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) |
| 22692 | oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) |
| 22693 | x.Write(ctx, oprot) |
| 22694 | oprot.WriteMessageEnd(ctx) |
| 22695 | oprot.Flush(ctx) |
| 22696 | return false, thrift.WrapTException(err2) |
| 22697 | } |
| 22698 | iprot.ReadMessageEnd(ctx) |
| 22699 | |
| 22700 | tickerCancel := func() {} |
| 22701 | // Start a goroutine to do server side connectivity check. |
| 22702 | if thrift.ServerConnectivityCheckInterval > 0 { |
| 22703 | var cancel context.CancelFunc |
| 22704 | ctx, cancel = context.WithCancel(ctx) |
| 22705 | defer cancel() |
| 22706 | var tickerCtx context.Context |
| 22707 | tickerCtx, tickerCancel = context.WithCancel(context.Background()) |
| 22708 | defer tickerCancel() |
| 22709 | go func(ctx context.Context, cancel context.CancelFunc) { |
| 22710 | ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) |
| 22711 | defer ticker.Stop() |
| 22712 | for { |
| 22713 | select { |
| 22714 | case <-ctx.Done(): |
| 22715 | return |
| 22716 | case <-ticker.C: |
| 22717 | if !iprot.Transport().IsOpen() { |
| 22718 | cancel() |
| 22719 | return |
| 22720 | } |
| 22721 | } |
| 22722 | } |
| 22723 | }(tickerCtx, cancel) |
| 22724 | } |
| 22725 | |
| 22726 | result := IClientRPCServiceCloseOperationResult{} |
| 22727 | var retval *common.TSStatus |
| 22728 | if retval, err2 = p.handler.CloseOperation(ctx, args.Req); err2 != nil { |
| 22729 | tickerCancel() |
| 22730 | if err2 == thrift.ErrAbandonRequest { |
| 22731 | return false, thrift.WrapTException(err2) |
| 22732 | } |
| 22733 | x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeOperation: " + err2.Error()) |
| 22734 | oprot.WriteMessageBegin(ctx, "closeOperation", thrift.EXCEPTION, seqId) |
| 22735 | x.Write(ctx, oprot) |
| 22736 | oprot.WriteMessageEnd(ctx) |
| 22737 | oprot.Flush(ctx) |
| 22738 | return true, thrift.WrapTException(err2) |
| 22739 | } else { |
| 22740 | result.Success = retval |
| 22741 | } |
| 22742 | tickerCancel() |
| 22743 | if err2 = oprot.WriteMessageBegin(ctx, "closeOperation", thrift.REPLY, seqId); err2 != nil { |
nothing calls this directly
no test coverage detected