From e6765c055982209b910fcf619625091431a10d8f Mon Sep 17 00:00:00 2001 From: divinity76 Date: Mon, 6 Dec 2021 19:24:04 +0100 Subject: [PATCH] Only close curl handle if it's done (#2950) --- src/Handler/CurlMultiHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Handler/CurlMultiHandler.php b/src/Handler/CurlMultiHandler.php index ace0d840c..9e2e4703e 100644 --- a/src/Handler/CurlMultiHandler.php +++ b/src/Handler/CurlMultiHandler.php @@ -225,6 +225,10 @@ private function cancel($id): bool private function processMessages(): void { while ($done = \curl_multi_info_read($this->_mh)) { + if ($done['msg'] !== \CURLMSG_DONE) { + // if it's not done, then it would be premature to remove the handle. ref https://github.com/guzzle/guzzle/pull/2892#issuecomment-945150216 + continue; + } $id = (int) $done['handle']; \curl_multi_remove_handle($this->_mh, $done['handle']);