1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

pause: return early for calls that don't change pause state

Reviewed-by: Patrick Monnerat
Ref: #4833
Closes #5026
This commit is contained in:
Daniel Stenberg 2020-03-03 08:10:09 +01:00
parent 485d4470d3
commit 64258bd0aa
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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;