From 92e8759bada6e3e65f0aa8a91470426b35483ee1 Mon Sep 17 00:00:00 2001 From: fengweihao Date: Tue, 30 Jul 2019 11:04:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=81=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E5=90=8E=E7=BB=AD=E6=B5=81?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=80=A0=E6=88=90=E6=AE=B5=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/protocol/http2/src/http2_stream.cpp | 12 ++++++++++-- 1 file 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))))