增加HTTP Session延迟回收机制,完善HTTP Session销毁流程

This commit is contained in:
Lu Qiuwen
2018-10-22 21:22:59 +08:00
parent 0f31b948ba
commit bcfe14055f
7 changed files with 224 additions and 50 deletions

View File

@@ -9,13 +9,19 @@ extern "C"
#include <http_half.h>
#include <http_parser.h>
TAILQ_HEAD(hs_private_list, http_session_private);
struct http_plugin
{
/* Garbage List for HTTP-SESSION object.
* these objects can not be destroyed when TCP connection terminated. */
struct hs_private_list gc_list_hs_private[TFE_THREAD_MAX];
/* Lock for garbage list */
pthread_mutex_t lock_list_hs_private[TFE_THREAD_MAX];
/* GC events */
struct event * gc_event_hs_private[TFE_THREAD_MAX];
};
TAILQ_HEAD(hs_private_list, http_session_private);
struct http_plugin_status
{
@@ -41,6 +47,12 @@ struct http_session_private
tfe_http_event suspend_event;
/* SUSPEND TAG EFFECTIVE */
bool suspend_tag_effective;
/* STREAM WRITE EFFECTIVE */
bool stream_write_tag_effective;
/* RELEASE LOCK, when the tag is zero, the session can be destroyed */
int release_lock;
/* thread id */
unsigned int thread_id;
};
struct http_connection_private

View File

@@ -118,10 +118,11 @@ void hf_private_set_callback(struct http_half_private * hf_private, hf_private_c
void hf_private_set_session(struct http_half_private * hf_private, struct http_session_private * hs_private);
struct http_session_private * hs_private_create(struct http_connection_private * hc_private,
struct http_half_private * hf_private_req, struct http_half_private * hf_private_resp);
struct http_session_private * hs_private_create(struct http_connection_private * hc_private, unsigned int thread_id,
struct http_half_private * hf_private_req, struct http_half_private * hf_private_resp);
void hs_private_destory(struct http_session_private * hs_private);
void hs_private_destroy(struct http_session_private * hs_private);
void hs_private_gc_destroy(struct http_session_private * hs_private, struct hs_private_list * gc_list);
void hs_private_hf_private_set(struct http_session_private * hs_private,
struct http_half_private * hf, enum tfe_http_direction);