From 7522d50d1a8c2f473e86a7763ebd1f7dbce6bfc7 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 5 Apr 2015 23:13:29 +0900 Subject: [PATCH] nghttpd, tiny-nghttpd: No need to check existence of stream The stream existence is guaranteed by library as of cc03a12b75e907d43527a4640bc92eb4fa3168b3. --- examples/tiny-nghttpd.c | 10 ++-------- src/HttpServer.cc | 6 ------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/examples/tiny-nghttpd.c b/examples/tiny-nghttpd.c index dd02e3d2..b25293fe 100644 --- a/examples/tiny-nghttpd.c +++ b/examples/tiny-nghttpd.c @@ -660,17 +660,11 @@ static void stream_error(connection *conn, int32_t stream_id, static int send_data_callback(nghttp2_session *session _U_, nghttp2_frame *frame, const uint8_t *framehd, - size_t length, nghttp2_data_source *source _U_, + size_t length, nghttp2_data_source *source, void *user_data) { connection *conn = user_data; uint8_t *p = conn->buf.last; - stream *strm; - - strm = nghttp2_session_get_stream_user_data(session, frame->hd.stream_id); - - if (!strm) { - return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; - } + stream *strm = source->ptr; /* We never use padding in this program */ assert(frame->data.padlen == 0); diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 1037c7ed..e8377a6e 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -1218,12 +1218,6 @@ int send_data_callback(nghttp2_session *session, nghttp2_frame *frame, const uint8_t *framehd, size_t length, nghttp2_data_source *source, void *user_data) { auto hd = static_cast(user_data); - auto stream = hd->get_stream(frame->hd.stream_id); - - if (!stream) { - return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; - } - auto wb = hd->get_wb(); auto padlen = frame->data.padlen;