[Pkg-php-commits] [php/debian-experimental] Avoid a useless 15 seconds sleep on php_curl_stream_read under heavy load

Raphael Geissert atomo64 at gmail.com
Wed Jun 24 22:39:24 UTC 2009


Patch already incorporated upstream on the 5.3 and HEAD branches.

Thanks to Giuseppe Bonacci <g.bonacci at libero.it> for the patch, closes: #514832
---
 debian/patches/curl_streams_sleep.patch |   24 ++++++++++++++++++++++++
 debian/patches/series                   |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100644 debian/patches/curl_streams_sleep.patch

diff --git a/debian/patches/curl_streams_sleep.patch b/debian/patches/curl_streams_sleep.patch
new file mode 100644
index 0000000..7bfc552
--- /dev/null
+++ b/debian/patches/curl_streams_sleep.patch
@@ -0,0 +1,24 @@
+Index: php/ext/curl/streams.c
+===================================================================
+--- php.orig/ext/curl/streams.c
++++ php/ext/curl/streams.c
+@@ -166,7 +166,8 @@ static size_t php_curl_stream_read(php_s
+ 			tv.tv_sec = 15; /* TODO: allow this to be configured from the script */
+ 
+ 			/* wait for data */
+-			switch (select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &tv)) {
++			switch ((curlstream->maxfd < 0) ? 1 :
++					select(curlstream->maxfd + 1, &curlstream->readfds, &curlstream->writefds, &curlstream->excfds, &tv)) {
+ 				case -1:
+ 					/* error */
+ 					return 0;
+@@ -179,7 +180,8 @@ static size_t php_curl_stream_read(php_s
+ 						curlstream->mcode = curl_multi_perform(curlstream->multi, &curlstream->pending);
+ 					} while (curlstream->mcode == CURLM_CALL_MULTI_PERFORM);
+ 			}
+-		} while (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0);
++		} while (curlstream->maxfd >= 0 &&
++				curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending > 0);
+ 
+ 	}
+ 
diff --git a/debian/patches/series b/debian/patches/series
index d626109..a55b317 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -33,3 +33,4 @@ force_libmysqlclient_r.patch
 libedit_is_editline.patch
 bad_whatis_entries.patch
 sockets_spelling.patch
+curl_streams_sleep.patch
-- 
1.5.6.5





More information about the Pkg-php-commits mailing list