增加Per Stream摘要日志功能,修正TCP上、下游连接不能联动关闭的问题。
* 增加Per Stream摘要日志功能,记录连接四元组、HTTP URL等关键信息,便于调试; * 原实现在上游连接关闭时,不能关闭下游连接(反之亦然),现修正。
This commit is contained in:
@@ -28,6 +28,7 @@ int http_connection_entry_open(const struct tfe_stream * stream, unsigned int th
|
||||
{
|
||||
struct http_connection_private * ht_conn = ALLOC(struct http_connection_private, 1);
|
||||
TAILQ_INIT(&ht_conn->hs_private_list);
|
||||
ht_conn->stream = stream;
|
||||
*pme = (void *)ht_conn;
|
||||
return 0;
|
||||
}
|
||||
@@ -89,12 +90,18 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
|
||||
TAILQ_INSERT_TAIL(&hc_private->hs_private_list, hs_private, next);
|
||||
}
|
||||
|
||||
/* proceed parse content for last request */
|
||||
/* Parse the content, the data which in defered state has been ignored. */
|
||||
ret = hf_private_parse(hf_private_request, data, len);
|
||||
|
||||
/* Need more data, no boundary touched */
|
||||
if (ret == 0)
|
||||
{
|
||||
if (hf_private_request->stream_action == ACTION_DROP_DATA ||
|
||||
hf_private_request->stream_action == ACTION_FORWARD_DATA)
|
||||
{
|
||||
hf_private_request->parse_cursor = 0;
|
||||
}
|
||||
|
||||
return hf_private_request->stream_action;
|
||||
}
|
||||
|
||||
@@ -185,8 +192,19 @@ __detach:
|
||||
void http_connection_entry_close(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
enum tfe_stream_close_reason reason, void ** pme)
|
||||
{
|
||||
struct http_connection_private * __ht_conn = (struct http_connection_private *)(*pme);
|
||||
free(__ht_conn);
|
||||
struct http_connection_private * ht_conn = (struct http_connection_private *)(*pme);
|
||||
|
||||
/* Delete all live sessions */
|
||||
struct http_session_private * hs_private_iter = NULL;
|
||||
TAILQ_FOREACH(hs_private_iter, &ht_conn->hs_private_list, next)
|
||||
{
|
||||
TAILQ_REMOVE(&ht_conn->hs_private_list, hs_private_iter, next);
|
||||
hs_private_destory(hs_private_iter);
|
||||
}
|
||||
|
||||
/* Clear session counter, and free ht_conn structure */
|
||||
ht_conn->session_id_counter = 0;
|
||||
free(ht_conn); *pme = NULL;
|
||||
}
|
||||
|
||||
static struct tfe_plugin __http_plugin_info =
|
||||
|
||||
Reference in New Issue
Block a user