summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-03-03 08:10:09 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-03-03 08:10:09 +0100
commit79818010783d1ad0add4f7c8615839e2fa1fbf4c (patch)
tree2aa2239bab27eef971ef87d21e85892ce994b2f5
parent18901c7bb7a3a718681267210355ac62d8a3e314 (diff)
downloadcurl-bagder/pause-noop.tar.gz
pause: return early for calls that don't change pause statebagder/pause-noop
Ref: #4833
-rw-r--r--lib/easy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 1a6912748..88b7c9d2a 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -975,6 +975,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
{
struct SingleRequest *k = &data->req;
CURLcode result = CURLE_OK;
+ int oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
/* first switch off both pause bits */
int newstate = k->keepon &~ (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE);
@@ -983,6 +984,12 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
newstate |= ((action & CURLPAUSE_RECV)?KEEP_RECV_PAUSE:0) |
((action & CURLPAUSE_SEND)?KEEP_SEND_PAUSE:0);
+ if((newstate & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE)) == oldstate) {
+ /* Not changing any pause state, return */
+ DEBUGF(infof(data, "pause: no change, early return\n"));
+ return CURLE_OK;
+ }
+
/* put it back in the keepon */
k->keepon = newstate;