增加HTTP Session延迟回收机制,完善HTTP Session销毁流程
This commit is contained in:
@@ -80,6 +80,28 @@ static inline bool __is_ssl(struct tfe_stream_private * _stream)
|
||||
return (_stream->session_type == STREAM_PROTO_SSL);
|
||||
}
|
||||
|
||||
static void __call_plugin_close(struct tfe_stream_private * _stream)
|
||||
{
|
||||
unsigned int plugin_id_iter = 0;
|
||||
unsigned int plugin_id = 0;
|
||||
|
||||
for (const struct tfe_plugin * p_info_iter = tfe_plugin_iterate(&plugin_id_iter);
|
||||
p_info_iter != NULL; p_info_iter = tfe_plugin_iterate(&plugin_id_iter))
|
||||
{
|
||||
_stream->calling_idx = plugin_id;
|
||||
struct plugin_ctx * plug_ctx = &_stream->plugin_ctxs[plugin_id];
|
||||
|
||||
/* TODO: do not use pme to determinate we call on_open or not ever. */
|
||||
if (p_info_iter->on_close && plug_ctx->pme != NULL)
|
||||
{
|
||||
p_info_iter->on_close(&_stream->head, _stream->thread_ref->thread_id,
|
||||
REASON_PASSIVE_CLOSED, &(plug_ctx->pme));
|
||||
}
|
||||
|
||||
plugin_id++;
|
||||
}
|
||||
}
|
||||
|
||||
/* ====================================================================================================================
|
||||
* INTERFACE
|
||||
* ===================================================================================================================*/
|
||||
@@ -341,6 +363,7 @@ static void __stream_bev_passthrough_writecb(struct bufferevent * bev, void * ar
|
||||
|
||||
if (*ref_peer_conn == NULL && *ref_this_conn == NULL)
|
||||
{
|
||||
__call_plugin_close(_stream);
|
||||
tfe_stream_destory(_stream);
|
||||
}
|
||||
|
||||
@@ -398,6 +421,7 @@ __close_connection:
|
||||
|
||||
if (*ref_this_conn == NULL && *ref_peer_conn == NULL)
|
||||
{
|
||||
__call_plugin_close(_stream);
|
||||
tfe_stream_destory(_stream);
|
||||
}
|
||||
|
||||
@@ -553,6 +577,7 @@ static void __stream_bev_writecb(struct bufferevent * bev, void * arg)
|
||||
|
||||
if (*ref_peer_conn == NULL && *ref_this_conn == NULL)
|
||||
{
|
||||
__call_plugin_close(_stream);
|
||||
tfe_stream_destory(_stream);
|
||||
}
|
||||
|
||||
@@ -637,25 +662,6 @@ __close_connection:
|
||||
return;
|
||||
|
||||
__call_plugin_close:
|
||||
unsigned int plugin_id_iter = 0;
|
||||
unsigned int plugin_id = 0;
|
||||
|
||||
for (const struct tfe_plugin * p_info_iter = tfe_plugin_iterate(&plugin_id_iter);
|
||||
p_info_iter != NULL; p_info_iter = tfe_plugin_iterate(&plugin_id_iter))
|
||||
{
|
||||
_stream->calling_idx = plugin_id;
|
||||
struct plugin_ctx * plug_ctx = &_stream->plugin_ctxs[plugin_id];
|
||||
|
||||
//TODO: do not use pme to determinate we call on_open or not ever.
|
||||
if (p_info_iter->on_close && plug_ctx->pme != NULL)
|
||||
{
|
||||
p_info_iter->on_close(&_stream->head, _stream->thread_ref->thread_id,
|
||||
REASON_PASSIVE_CLOSED, &(plug_ctx->pme));
|
||||
}
|
||||
|
||||
plugin_id++;
|
||||
}
|
||||
|
||||
tfe_stream_destory(_stream);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user