From 306dcc6ce03c011f2f2565bf3376dc67cedcffa8 Mon Sep 17 00:00:00 2001 From: luqiuwen Date: Sun, 2 Jun 2019 17:52:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9C=A8=E6=B5=81=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E6=97=B6=E8=B0=83=E7=94=A8cmsg=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/include/internal/sender_scm.h | 1 + platform/src/tcp_stream.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/include/internal/sender_scm.h b/platform/include/internal/sender_scm.h index 94f9ab1..3b925e4 100644 --- a/platform/include/internal/sender_scm.h +++ b/platform/include/internal/sender_scm.h @@ -3,3 +3,4 @@ struct sender_scm; void send_scm_destroy(struct sender_scm *sender); struct sender_scm* sender_scm_init(const char *profile, const char *section, void *logger); +int sender_scm_cmsg_send(struct sender_scm *sender, struct tfe_cmsg *cmsg); diff --git a/platform/src/tcp_stream.cpp b/platform/src/tcp_stream.cpp index 9b23a3c..6fa362c 100644 --- a/platform/src/tcp_stream.cpp +++ b/platform/src/tcp_stream.cpp @@ -1027,6 +1027,7 @@ void __stream_close_stat(struct tfe_stream_private * stream) void tfe_stream_destory(struct tfe_stream_private * stream) { + struct tfe_proxy * proxy = stream->proxy_ref; struct tfe_thread_ctx * thread = stream->thread_ref; struct event_base * ev_base = thread->evbase; @@ -1084,8 +1085,18 @@ void tfe_stream_destory(struct tfe_stream_private * stream) { future_destroy(stream->future_upstream_create); } - FREE(&(stream->plugin_ctxs)); + if (proxy->scm_sender && stream->cmsg) + { + sender_scm_cmsg_send(proxy->scm_sender, stream->cmsg); + } + + if (stream->cmsg) + { + tfe_cmsg_destroy(stream->cmsg); + } + + FREE(&(stream->plugin_ctxs)); tfe_proxy_thread_ctx_release(stream->thread_ref); stream->proxy_ref = NULL; FREE(&(stream));