- better example/approach of using the protected HttpRequestPool methods
authorMichael Wallner <mike@php.net>
Wed, 19 Oct 2005 07:49:10 +0000 (07:49 +0000)
committerMichael Wallner <mike@php.net>
Wed, 19 Oct 2005 07:49:10 +0000 (07:49 +0000)
  to process intermediate request results

http_requestpool_object.c
tests/HttpRequestPool_002.phpt

index c0ae1357d3e9ca9126a11907faaff40af9c951b4..b6662e1c7f7fca9a62bbe813190e42a32b0a8ea5 100644 (file)
@@ -333,20 +333,20 @@ PHP_METHOD(HttpRequestPool, send)
  *     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;
  *     }
  * } 
  * ?>
index 053f1f6b76804c3d769b229c516f1f3e4aeaf1dd..26b11593caec8b869011a4fcd96f925ad5beb51a 100644 (file)
@@ -14,21 +14,23 @@ class MyPool extends HttpRequestPool
        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;
        }
 }