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

Method Process

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

Source from the content-addressed store, hash-verified

21973}
21974
21975func (p *iClientRPCServiceProcessorOpenSession) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
21976 args := IClientRPCServiceOpenSessionArgs{}
21977 var err2 error
21978 if err2 = args.Read(ctx, iprot); err2 != nil {
21979 iprot.ReadMessageEnd(ctx)
21980 x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error())
21981 oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId)
21982 x.Write(ctx, oprot)
21983 oprot.WriteMessageEnd(ctx)
21984 oprot.Flush(ctx)
21985 return false, thrift.WrapTException(err2)
21986 }
21987 iprot.ReadMessageEnd(ctx)
21988
21989 tickerCancel := func() {}
21990 // Start a goroutine to do server side connectivity check.
21991 if thrift.ServerConnectivityCheckInterval > 0 {
21992 var cancel context.CancelFunc
21993 ctx, cancel = context.WithCancel(ctx)
21994 defer cancel()
21995 var tickerCtx context.Context
21996 tickerCtx, tickerCancel = context.WithCancel(context.Background())
21997 defer tickerCancel()
21998 go func(ctx context.Context, cancel context.CancelFunc) {
21999 ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval)
22000 defer ticker.Stop()
22001 for {
22002 select {
22003 case <-ctx.Done():
22004 return
22005 case <-ticker.C:
22006 if !iprot.Transport().IsOpen() {
22007 cancel()
22008 return
22009 }
22010 }
22011 }
22012 }(tickerCtx, cancel)
22013 }
22014
22015 result := IClientRPCServiceOpenSessionResult{}
22016 var retval *TSOpenSessionResp
22017 if retval, err2 = p.handler.OpenSession(ctx, args.Req); err2 != nil {
22018 tickerCancel()
22019 if err2 == thrift.ErrAbandonRequest {
22020 return false, thrift.WrapTException(err2)
22021 }
22022 x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing openSession: " + err2.Error())
22023 oprot.WriteMessageBegin(ctx, "openSession", thrift.EXCEPTION, seqId)
22024 x.Write(ctx, oprot)
22025 oprot.WriteMessageEnd(ctx)
22026 oprot.Flush(ctx)
22027 return true, thrift.WrapTException(err2)
22028 } else {
22029 result.Success = retval
22030 }
22031 tickerCancel()
22032 if err2 = oprot.WriteMessageBegin(ctx, "openSession", thrift.REPLY, seqId); err2 != nil {

Callers

nothing calls this directly

Calls 5

ReadMethod · 0.95
WriteMethod · 0.95
OpenSessionMethod · 0.65
ErrorMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected