summaryrefslogtreecommitdiff
path: root/plugin/protocol/http2/src/http2_stream.cpp
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2019-07-30 11:04:50 +0800
committerfengweihao <[email protected]>2019-07-30 11:04:50 +0800
commit92e8759bada6e3e65f0aa8a91470426b35483ee1 (patch)
tree1df26f83b1db0c7c0f2f039ad271703f1c34b9e8 /plugin/protocol/http2/src/http2_stream.cpp
parentbd1861d6ce49ec764852ffa07f6c6c69ffddb28c (diff)
添加流处理失败后,后续流发送造成段错误问题
Diffstat (limited to 'plugin/protocol/http2/src/http2_stream.cpp')
-rw-r--r--plugin/protocol/http2/src/http2_stream.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp
index 734fd88..806037f 100644
--- a/plugin/protocol/http2/src/http2_stream.cpp
+++ b/plugin/protocol/http2/src/http2_stream.cpp
@@ -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))))