#34 实现HTTP解析层的Suspend/Resume操作
This commit is contained in:
@@ -93,6 +93,17 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
|
||||
TAILQ_INSERT_TAIL(&hc_private->hs_private_list, hs_private, next);
|
||||
}
|
||||
|
||||
/* The session is suspended, and to resume */
|
||||
if (hs_private->suspend_tag_effective)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/* Parse the content, the data which in defered state has been ignored. */
|
||||
ret = hf_private_parse(hf_private_req_in, data, len);
|
||||
|
||||
@@ -108,6 +119,17 @@ enum tfe_stream_action __http_connection_entry_on_request(const struct tfe_strea
|
||||
return hf_private_req_in->stream_action;
|
||||
}
|
||||
|
||||
/* Suspend */
|
||||
if (hs_private->suspend_tag_user)
|
||||
{
|
||||
assert(!hs_private->suspend_tag_effective);
|
||||
hs_private->suspend_tag_effective = true;
|
||||
|
||||
/* Suspend TCP stream */
|
||||
tfe_stream_suspend(stream);
|
||||
return ACTION_DEFER_DATA;
|
||||
}
|
||||
|
||||
/* Some kind of error happened, write log and detach the stream */
|
||||
if (ret == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user