添加流处理失败后,后续流发送造成段错误问题

This commit is contained in:
fengweihao
2019-07-30 11:04:50 +08:00
parent bd1861d6ce
commit 92e8759bad

View File

@@ -727,8 +727,16 @@ upstream_read_callback(nghttp2_session *session, int32_t stream_id,
void *user_data)
{
unsigned char *input = NULL;
ssize_t datalen = 0, inputlen=0;
ssize_t datalen = 0, inputlen=0;
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, stream_id);
if (h2_session == NULL)
{
TFE_LOG_ERROR(logger()->handle, "Failed to send data, stream_id %d", stream_id);
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
return 0;
}
struct tfe_h2_payload *to_send_body = (struct tfe_h2_payload *)source->ptr;
if (!to_send_body->evbuf_body || 0==(inputlen = evbuffer_get_length(to_send_body->evbuf_body))
||!(input = evbuffer_pullup(to_send_body->evbuf_body, MIN(length, inputlen))))