aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-05-11 15:54:50 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-05-18 09:33:47 +0200
commit3e8a5d88a5fe99a15a2c89aca8aca30d36243be9 (patch)
treea7f9b70c6296d6e23cf422b384c2f95ece07e67a /lib
parent522ca8c035e487801253f0349906160515389f7e (diff)
http2: if there is paused data, do not clear the drain field
Diffstat (limited to 'lib')
-rw-r--r--lib/http2.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/http2.c b/lib/http2.c
index c2e90613a..ad1826d55 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -388,7 +388,9 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
if(nread < len) {
stream->pausedata = data + nread;
stream->pauselen = len - nread;
- DEBUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - out of buffer\n"));
+ DEBUGF(infof(data_s, "NGHTTP2_ERR_PAUSE - %zu bytes out of buffer"
+ ", stream %x\n",
+ len - nread, stream_id));
conn->proto.httpc.pause_stream_id = stream_id;
return NGHTTP2_ERR_PAUSE;
}
@@ -853,7 +855,7 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
infof(data, "http2_recv: %d bytes buffer at %p (stream %x)\n",
len, mem, stream->stream_id);
- if(data->state.drain) {
+ if((data->state.drain) && stream->memlen) {
DEBUGF(infof(data, "http2_recv: DRAIN %zu bytes stream %x!! (%p => %p)\n",
stream->memlen, stream->stream_id,
stream->mem, mem));
@@ -881,8 +883,8 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
stream->pausedata = NULL;
stream->pauselen = 0;
}
- infof(data, "http2_recv: returns %zd bytes from stream->data\n",
- nread);
+ infof(data, "http2_recv: returns unpaused %zd bytes on stream %x\n",
+ nread, stream->stream_id);
return nread;
}
else if(httpc->pause_stream_id) {
@@ -967,12 +969,19 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
}
if(stream->memlen) {
ssize_t retlen = stream->memlen;
- infof(data, "http2_recv: returns %zd for stream %x (%zu/%zu)\n",
- retlen, stream->stream_id,
- len, stream->len);
- data->state.drain = 0; /* this stream is hereby drained */
+ infof(data, "http2_recv: returns %zd for stream %x\n",
+ retlen, stream->stream_id);
stream->memlen = 0;
+ if(httpc->pause_stream_id == stream->stream_id) {
+ /* data for this stream is returned now, but this stream caused a pause
+ already so we need it called again asap */
+ DEBUGF(infof(data, "Data returned for PAUSED stream %x\n",
+ stream->stream_id));
+ }
+ else
+ data->state.drain = 0; /* this stream is hereby drained */
+
return retlen;
}
/* If stream is closed, return 0 to signal the http routine to close