summaryrefslogtreecommitdiff
path: root/src/tsg_send_log.cpp
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2022-02-24 11:50:11 +0800
committerliuxueli <[email protected]>2022-02-24 11:50:11 +0800
commit1404744671e412510bafa0af3f3e774a729eef71 (patch)
treebdaba2dbb2b50d42bb310fb8c034a202e762d211 /src/tsg_send_log.cpp
parentd7e4d0b62a08366d65c266f91fe0b6ea6e38aa37 (diff)
TSG-9700: 支持优雅退出
Diffstat (limited to 'src/tsg_send_log.cpp')
-rw-r--r--src/tsg_send_log.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index 7bdfd30..91993ec 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -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)
+ return ;
+ }
+
+ if(instance->mode==CLOSE)
+ {
+ for(int i=0; i<instance->max_service; i++)
{
- continue;
+ 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;
- rd_kafka_topic_destroy(instance->topic_rkt[i]);
+ free(instance->service2topic);
+ instance->service2topic=NULL;
}
-
- rd_kafka_destroy_flags(instance->kafka_handle, 4);
- rd_kafka_destroy(instance->kafka_handle);
+
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;
/*