Skip to content

Commit

Permalink
hyper: use wakers for curl pause/resume
Browse files Browse the repository at this point in the history
Closes #9070
  • Loading branch information
seanmonstar authored and bagder committed Jun 30, 2022
1 parent c7f53b7 commit be8d2b0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
15 changes: 12 additions & 3 deletions lib/c-hyper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/c-hyper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions lib/easy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) !=
Expand Down
4 changes: 0 additions & 4 deletions tests/data/DISABLED
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@
565
579
587
670
671
672
673
# 1021 re-added here due to flakiness
1021
1117
Expand Down

0 comments on commit be8d2b0

Please sign in to comment.