(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol)
| 23237 | } |
| 23238 | |
| 23239 | func (p *iClientRPCServiceProcessorSetStorageGroup) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) { |
| 23240 | args := IClientRPCServiceSetStorageGroupArgs{} |
| 23241 | var err2 error |
| 23242 | if err2 = args.Read(ctx, iprot); err2 != nil { |
| 23243 | iprot.ReadMessageEnd(ctx) |
| 23244 | x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err2.Error()) |
| 23245 | oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) |
| 23246 | x.Write(ctx, oprot) |
| 23247 | oprot.WriteMessageEnd(ctx) |
| 23248 | oprot.Flush(ctx) |
| 23249 | return false, thrift.WrapTException(err2) |
| 23250 | } |
| 23251 | iprot.ReadMessageEnd(ctx) |
| 23252 | |
| 23253 | tickerCancel := func() {} |
| 23254 | // Start a goroutine to do server side connectivity check. |
| 23255 | if thrift.ServerConnectivityCheckInterval > 0 { |
| 23256 | var cancel context.CancelFunc |
| 23257 | ctx, cancel = context.WithCancel(ctx) |
| 23258 | defer cancel() |
| 23259 | var tickerCtx context.Context |
| 23260 | tickerCtx, tickerCancel = context.WithCancel(context.Background()) |
| 23261 | defer tickerCancel() |
| 23262 | go func(ctx context.Context, cancel context.CancelFunc) { |
| 23263 | ticker := time.NewTicker(thrift.ServerConnectivityCheckInterval) |
| 23264 | defer ticker.Stop() |
| 23265 | for { |
| 23266 | select { |
| 23267 | case <-ctx.Done(): |
| 23268 | return |
| 23269 | case <-ticker.C: |
| 23270 | if !iprot.Transport().IsOpen() { |
| 23271 | cancel() |
| 23272 | return |
| 23273 | } |
| 23274 | } |
| 23275 | } |
| 23276 | }(tickerCtx, cancel) |
| 23277 | } |
| 23278 | |
| 23279 | result := IClientRPCServiceSetStorageGroupResult{} |
| 23280 | var retval *common.TSStatus |
| 23281 | if retval, err2 = p.handler.SetStorageGroup(ctx, args.SessionId, args.StorageGroup); err2 != nil { |
| 23282 | tickerCancel() |
| 23283 | if err2 == thrift.ErrAbandonRequest { |
| 23284 | return false, thrift.WrapTException(err2) |
| 23285 | } |
| 23286 | x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing setStorageGroup: " + err2.Error()) |
| 23287 | oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.EXCEPTION, seqId) |
| 23288 | x.Write(ctx, oprot) |
| 23289 | oprot.WriteMessageEnd(ctx) |
| 23290 | oprot.Flush(ctx) |
| 23291 | return true, thrift.WrapTException(err2) |
| 23292 | } else { |
| 23293 | result.Success = retval |
| 23294 | } |
| 23295 | tickerCancel() |
| 23296 | if err2 = oprot.WriteMessageBegin(ctx, "setStorageGroup", thrift.REPLY, seqId); err2 != nil { |
nothing calls this directly
no test coverage detected