修复残留数据,造成select_padding函数段错误

This commit is contained in:
fengweihao
2019-07-31 13:45:08 +08:00
parent 92e8759bad
commit aa88471f25
2 changed files with 29 additions and 35 deletions

View File

@@ -1056,19 +1056,17 @@ nghttp2_submit_frame_ping(struct tfe_h2_stream *connection,const nghttp2_frame *
nghttp2_session *ngh2_session = tfe_h2_stream_get_nghttp2_session(connection, dir);
rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags,
ping->opaque_data);
if (rv != 0){
rv = nghttp2_submit_ping(ngh2_session, ping->hd.flags, ping->opaque_data);
if (rv != 0)
{
stream_action = ACTION_FORWARD_DATA;
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n",
dir, nghttp2_strerror(rv));
TFE_LOG_ERROR(logger()->handle, "dir(%d), Submit ping error: %s\n", dir, nghttp2_strerror(rv));
return 0;
}
xret = nghttp2_session_send(ngh2_session);
if (xret != 0) {
stream_action = ACTION_FORWARD_DATA;
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n",
dir, nghttp2_strerror(xret));
TFE_LOG_ERROR(logger()->handle, "dir(%d), Fatal send error: %s\n", dir, nghttp2_strerror(xret));
}
connection->stream_action = stream_action;
return 0;
@@ -1842,7 +1840,8 @@ nghttp2_client_submit_header(struct tfe_h2_stream *h2_stream_info, int32_t strea
assert(h2_session->ngh2_stream_id == stream_id);
req = h2_session->req;
fill_req_spec_from_handle(h2_session->req);
fill_req_spec_from_handle(h2_session->req);
h2_stream_info->as_client->last_sent_stream_id = MIN(h2_stream_info->as_client->last_sent_stream_id, stream_id) - 1;
req->event_cb(req, EV_HTTP_REQ_HDR, NULL, 0, req->event_cb_user);
@@ -2260,15 +2259,15 @@ static ssize_t nghttp2_client_select_padding_callback(nghttp2_session *session,
size_t max_payloadlen, void *user_data)
{
struct tfe_h2_half_private *resp = NULL;
struct tfe_h2_session *h2_session = NULL;
h2_session = (struct tfe_h2_session *)nghttp2_session_get_stream_user_data(session, frame->hd.stream_id);
if (!h2_session)
return frame->hd.length;
struct tfe_h2_stream *h2_stream_info = (struct tfe_h2_stream *)user_data;
struct tfe_h2_session *h2_session = TAILQ_LIST_FIND(h2_stream_info, frame->hd.stream_id);
if (h2_session == NULL) return frame->hd.length;
resp = h2_session->resp;
if (!resp)
if (resp == NULL)
return frame->hd.length;
return (ssize_t)MIN(max_payloadlen, frame->hd.length + (resp->h2_payload.padlen));
}