From c53c1dc66978fe146583dd976f8ade12a08d5be0 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 3 Apr 2014 00:01:35 +0900 Subject: [PATCH] nghttp2_session_resume_data: Return error if no deferred data exist --- lib/includes/nghttp2/nghttp2.h | 3 ++- lib/nghttp2_session.c | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index b29a96d9..e3b85d53 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -1848,7 +1848,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, * negative error codes: * * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT` - * The stream does not exist or no deferred data exist. + * The stream does not exist; or no deferred data exist; or data + * was deferred by flow control. * :enum:`NGHTTP2_ERR_NOMEM` * Out of memory. */ diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 5d47a4f3..d41d5699 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -5468,14 +5468,11 @@ int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) nghttp2_stream *stream; stream = nghttp2_session_get_stream(session, stream_id); if(stream == NULL || - nghttp2_stream_check_deferred_by_flow_control(stream)) { + nghttp2_stream_check_deferred_by_flow_control(stream) || + !nghttp2_stream_check_deferred_data(stream)) { return NGHTTP2_ERR_INVALID_ARGUMENT; } - if(!nghttp2_stream_check_deferred_data(stream)) { - return 0; - } - rv = nghttp2_stream_resume_deferred_data(stream, &session->ob_pq); if(nghttp2_is_fatal(rv)) {