mike Wed Oct 19 03:49:10 2005 EDT
Modified files:
/pecl/http http_requestpool_object.c
/pecl/http/tests HttpRequestPool_002.phpt
Log:
- better example/approach of using the protected HttpRequestPool methods
to process intermediate request results
http://cvs.php.net/diff.php/pecl/http/http_requestpool_object.c?r1=1.22&r2=1.23&ty=u
Index: pecl/http/http_requestpool_object.c
diff -u pecl/http/http_requestpool_object.c:1.22
pecl/http/http_requestpool_object.c:1.23
--- pecl/http/http_requestpool_object.c:1.22 Tue Oct 18 07:18:33 2005
+++ pecl/http/http_requestpool_object.c Wed Oct 19 03:49:06 2005
@@ -13,7 +13,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: http_requestpool_object.c,v 1.22 2005/10/18 11:18:33 mike Exp $ */
+/* $Id: http_requestpool_object.c,v 1.23 2005/10/19 07:49:06 mike Exp $ */
#ifdef HAVE_CONFIG_H
@@ -333,20 +333,20 @@
* public function send()
* {
* while ($this->socketPerform()) {
- * $this->handleRequests();
* if (!$this->socketSelect()) {
* throw new HttpSocketExcpetion;
* }
* }
- * $this->handleRequests();
* }
*
- * private function handleRequests()
+ * protected final function socketPerform()
* {
+ * $result = parent::socketPerform();
* foreach ($this->getFinishedRequests() as $r) {
* $this->detach($r);
* // handle response of finished request
* }
+ * return $result;
* }
* }
* ?>
http://cvs.php.net/diff.php/pecl/http/tests/HttpRequestPool_002.phpt?r1=1.1&r2=1.2&ty=u
Index: pecl/http/tests/HttpRequestPool_002.phpt
diff -u pecl/http/tests/HttpRequestPool_002.phpt:1.1
pecl/http/tests/HttpRequestPool_002.phpt:1.2
--- pecl/http/tests/HttpRequestPool_002.phpt:1.1 Tue Oct 18 05:34:42 2005
+++ pecl/http/tests/HttpRequestPool_002.phpt Wed Oct 19 03:49:10 2005
@@ -14,21 +14,23 @@
public function send()
{
while ($this->socketPerform()) {
- $this->handleRequests();
if (!$this->socketSelect()) {
throw new HttpSocketException;
}
}
- $this->handleRequests();
}
- private function handleRequests()
+ protected final function socketPerform()
{
+ $result = parent::socketPerform();
+
echo ".";
foreach ($this->getFinishedRequests() as $r) {
echo "=", $r->getResponseCode(), "=";
$this->detach($r);
}
+
+ return $result;
}
}
|