diff options
author | Sean McArthur <sean@seanmonstar.com> | 2022-06-29 17:45:32 -0700 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-06-30 10:19:08 +0200 |
commit | be8d2b037da92e39044366fbbaf2dd2e6e30685b (patch) | |
tree | 82d1d6d7d3ba5d8982901096e35405239494898d /lib | |
parent | c7f53b749301df5fdc9c47a614a7e831af928709 (diff) | |
download | curl-be8d2b037da92e39044366fbbaf2dd2e6e30685b.tar.gz |
hyper: use wakers for curl pause/resume
Closes #9070
Diffstat (limited to 'lib')
-rw-r--r-- | lib/c-hyper.c | 15 | ||||
-rw-r--r-- | lib/c-hyper.h | 1 | ||||
-rw-r--r-- | lib/easy.c | 10 |
3 files changed, 23 insertions, 3 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c index 69b904e53..93b912c47 100644 --- a/lib/c-hyper.c +++ b/lib/c-hyper.c @@ -692,9 +692,18 @@ static int uploadstreamed(void *userdata, hyper_context *ctx, data->state.hresult = result; return HYPER_POLL_ERROR; } - if(!fillcount) - /* done! */ - *chunk = NULL; + if(!fillcount) { + if((data->req.keepon & KEEP_SEND_PAUSE) != KEEP_SEND_PAUSE) + /* done! */ + *chunk = NULL; + else { + /* paused, save a waker */ + if(data->hyp.send_body_waker) + hyper_waker_free(data->hyp.send_body_waker); + data->hyp.send_body_waker = hyper_context_waker(ctx); + return HYPER_POLL_PENDING; + } + } else { hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount); if(copy) diff --git a/lib/c-hyper.h b/lib/c-hyper.h index 91a62619c..70507ad2a 100644 --- a/lib/c-hyper.h +++ b/lib/c-hyper.h @@ -36,6 +36,7 @@ struct hyptransfer { const hyper_executor *exec; hyper_task *endtask; hyper_waker *exp100_waker; + hyper_waker *send_body_waker; }; size_t Curl_hyper_recv(void *userp, hyper_context *ctx, diff --git a/lib/easy.c b/lib/easy.c index 704a59df6..06a94b01b 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1132,6 +1132,16 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) } } +#ifdef USE_HYPER + if(!(newstate & KEEP_SEND_PAUSE)) { + /* need to wake the send body waker */ + if(data->hyp.send_body_waker) { + hyper_waker_wake(data->hyp.send_body_waker); + data->hyp.send_body_waker = NULL; + } + } +#endif + /* if there's no error and we're not pausing both directions, we want to have this handle checked soon */ if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) != |