修正多TCP层插件同时注册时,只调用一个插件open函数的缺陷。

This commit is contained in:
Lu Qiuwen
2018-11-04 14:17:41 +08:00
parent 8962026092
commit d0ea605a5b
2 changed files with 4 additions and 7 deletions

View File

@@ -30,6 +30,7 @@ enum tfe_plugin_state
struct plugin_ctx
{
enum tfe_plugin_state state;
unsigned int is_plugin_opened;
void * pme;
};

View File

@@ -489,14 +489,10 @@ static void __stream_bev_readcb(struct bufferevent * bev, void * arg)
_stream->calling_idx = plugin_id;
struct plugin_ctx * plug_ctx = &_stream->plugin_ctxs[plugin_id];
if (_stream->is_plugin_opened == 0)
{
if (p_info_iter->on_open != NULL)
if (p_info_iter->on_open != NULL && plug_ctx->is_plugin_opened == 0)
{
p_info_iter->on_open(&_stream->head, _stream->thread_ref->thread_id, dir, &(plug_ctx->pme));
}
_stream->is_plugin_opened = 1;
plug_ctx->is_plugin_opened = 1;
}
if (p_info_iter->on_data != NULL)