From: Daniel Stenberg Date: Fri, 28 Feb 2020 22:55:05 +0000 (+0100) Subject: pause: force-drain the transfer on unpause X-Git-Tag: curl-7_69_0~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fa0216b294af4c7113a9040ca65eefc7fc18ac1c;p=thirdparty%2Fcurl.git pause: force-drain the transfer on unpause ... since the socket might not actually be readable anymore when for example the data is already buffered in the TLS layer. Fixes #4966 Reported-by: Anders Berg Closes #5000 --- diff --git a/lib/easy.c b/lib/easy.c index 454621076a..1a6912748e 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1033,6 +1033,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) to have this handle checked soon */ if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) != (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) { + data->state.drain++; Curl_expire(data, 0, EXPIRE_RUN_NOW); /* get this handle going again */ if(data->multi) Curl_update_timer(data->multi); diff --git a/lib/transfer.c b/lib/transfer.c index ead8b36db9..827076183f 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -1217,7 +1217,8 @@ CURLcode Curl_readwrite(struct connectdata *conn, else fd_write = CURL_SOCKET_BAD; - if(conn->data->state.drain) { + if(data->state.drain) { + data->state.drain--; select_res |= CURL_CSELECT_IN; DEBUGF(infof(data, "Curl_readwrite: forcibly told to drain data\n")); }