TSG-9700: 支持优雅退出
This commit is contained in:
@@ -1650,28 +1650,46 @@ struct tsg_log_instance_t *tsg_sendlog_init(const char *conffile)
|
||||
}
|
||||
void tsg_sendlog_destroy(struct tsg_log_instance_t * instance)
|
||||
{
|
||||
for(int i=0; i<instance->max_service; i++)
|
||||
if(instance==NULL)
|
||||
{
|
||||
if(instance->topic_rkt[i]==NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rd_kafka_topic_destroy(instance->topic_rkt[i]);
|
||||
return ;
|
||||
}
|
||||
|
||||
rd_kafka_destroy_flags(instance->kafka_handle, 4);
|
||||
rd_kafka_destroy(instance->kafka_handle);
|
||||
if(instance->mode==CLOSE)
|
||||
{
|
||||
for(int i=0; i<instance->max_service; i++)
|
||||
{
|
||||
if(instance->topic_rkt[i]==NULL)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
rd_kafka_topic_destroy(instance->topic_rkt[i]);
|
||||
}
|
||||
|
||||
//rd_kafka_destroy_flags(instance->kafka_handle, 4);
|
||||
//rd_kafka_destroy(instance->kafka_handle);
|
||||
|
||||
free(instance->topic_rkt);
|
||||
instance->topic_rkt=NULL;
|
||||
|
||||
free(instance->service2topic);
|
||||
instance->service2topic=NULL;
|
||||
}
|
||||
|
||||
|
||||
MESA_destroy_runtime_log_handle(instance->logger);
|
||||
instance->logger=NULL;
|
||||
|
||||
free(instance->topic_rkt);
|
||||
instance->topic_rkt=NULL;
|
||||
free(instance->drop_start);
|
||||
instance->drop_start=NULL;
|
||||
|
||||
free(instance->fs_status_ids);
|
||||
instance->fs_status_ids=NULL;
|
||||
|
||||
free(instance->send_log_percent);
|
||||
instance->send_log_percent=NULL;
|
||||
|
||||
free(instance->service2topic);
|
||||
instance->service2topic=NULL;
|
||||
|
||||
free(instance);
|
||||
instance=NULL;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user