修正suspend/resume语义实现的若干问题,增加自行构建request/response的header标志

This commit is contained in:
Lu Qiuwen
2018-10-26 20:30:06 +08:00
parent d3d34355ef
commit cf64f01f7f
9 changed files with 104 additions and 35 deletions

View File

@@ -309,13 +309,19 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
/* The session is suspended, and to resume */
if (hs_private->suspend_tag_effective)
{
enum tfe_http_event __backup_event = hs_private->suspend_event;
/* Clean up suspend tag, we can support user's call suspend in this callback */
hs_private->suspend_event = (enum tfe_http_event) 0;
hs_private->suspend_tag_effective = false;
hs_private->suspend_counter++;
/* Call user callback, tell user we resume from suspend */
hf_private_req_in->event_cb(hf_private_req_in, hs_private->suspend_event, NULL, 0,
hf_private_req_in->event_cb_user);
hs_private->suspend_event = (enum tfe_http_event) 0;
hs_private->suspend_tag_effective = false;
hs_private->suspend_tag_user = false;
#if 0
if (__on_request_handle_user_req_or_resp(stream, hs_private,
hf_private_req_in, __need_to_close_the_session) < 0)
{
@@ -333,6 +339,7 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
/* Ignore parse the content which is nullptr. */
goto __boundary;
#endif
}
/* Parse the content, the data which in defered state has been ignored. */
@@ -351,13 +358,8 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
}
/* Suspend */
if (hs_private->suspend_tag_user)
if (hs_private->suspend_tag_effective)
{
assert(!hs_private->suspend_tag_effective);
hs_private->suspend_tag_effective = true;
/* Suspend TCP stream */
tfe_stream_suspend(stream, CONN_DIR_DOWNSTREAM);
return ACTION_DEFER_DATA;
}