MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / Process

Method Process

rpc/client.go:22054–22127  ·  view source on GitHub ↗
(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)

Source from the content-addressed store, hash-verified

22052}
22053
22054func (p *iClientRPCServiceProcessorCloseSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
22055 args := IClientRPCServiceCloseSessionArgs{}
22056 var err2 error
22057 if err2 = args.Read(ctx, iprot); err2 != nil {
22058 iprot.ReadMessageEnd(ctx)
22059 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
22060 oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId)
22061 x.Write(ctx, oprot)
22062 oprot.WriteMessageEnd(ctx)
22063 oprot.Flush(ctx)
22064 return false, thrift.WrapTException(err2)
22065 }
22066 iprot.ReadMessageEnd(ctx)
22067
22068 tickerCancel := func() {}
22069 // Start a goroutine to do server side connectivity check.
22070 if thrift.ServerConnectivityCheckInterval > 0 {
22071 var cancel context.CancelFunc
22072 ctx, cancel = context.WithCancel(ctx)
22073 defer cancel()
22074 var tickerCtx context.Context
22075 tickerCtx, tickerCancel = context.WithCancel(context.Background())
22076 defer tickerCancel()
22077 go func(ctx context.Context, cancel context.CancelFunc) {
22078 ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
22079 defer ticker.Stop()
22080 for {
22081 select {
22082 case <-ctx.Done():
22083 return
22084 case <-ticker.C:
22085 if !iprot.Transport().IsOpen() {
22086 cancel()
22087 return
22088 }
22089 }
22090 }
22091 }(tickerCtx, cancel)
22092 }
22093
22094 result := IClientRPCServiceCloseSessionResult{}
22095 var retval *common.TSStatus
22096 if retval, err2 = p.handler.CloseSession(ctx, args.Req); err2 != nil {
22097 tickerCancel()
22098 if err2 == thrift.ErrAbandonRequest {
22099 return false, thrift.WrapTException(err2)
22100 }
22101 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing closeSession: " + err2.Error())
22102 oprot.WriteMessageBegin(ctx, "closeSession", thrift.EXCEPTION, seqId)
22103 x.Write(ctx, oprot)
22104 oprot.WriteMessageEnd(ctx)
22105 oprot.Flush(ctx)
22106 return true, thrift.WrapTException(err2)
22107 } else {
22108 result.Success = retval
22109 }
22110 tickerCancel()
22111 if err2 = oprot.WriteMessageBegin(ctx, "closeSession", thrift.REPLY, seqId); err2 != nil {

Callers

nothing calls this directly

Calls 5

ReadMethod · 0.95
WriteMethod · 0.95
CloseSessionMethod · 0.65
ErrorMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected