- made low-lewel request pool object api more intuitive
authorMichael Wallner <mike@php.net>
Fri, 26 Aug 2005 09:52:50 +0000 (09:52 +0000)
committerMichael Wallner <mike@php.net>
Fri, 26 Aug 2005 09:52:50 +0000 (09:52 +0000)
http_requestpool_object.c
package.xml
php_http_requestpool_object.h

index e01e26d21db5f8066a0119572b48c69fd3628664..b255e25ee2b58f83c3d9fbf6f72a7f62bcd3b636 100644 (file)
@@ -58,9 +58,8 @@ HTTP_BEGIN_ARGS(detach, 1)
 HTTP_END_ARGS;
 
 HTTP_EMPTY_ARGS(send, 0);
-HTTP_EMPTY_ARGS(socketSend, 0);
+HTTP_EMPTY_ARGS(socketPerform, 0);
 HTTP_EMPTY_ARGS(socketSelect, 0);
-HTTP_EMPTY_ARGS(socketRead, 0);
 
 HTTP_EMPTY_ARGS(valid, 0);
 HTTP_EMPTY_ARGS(current, 1);
@@ -80,9 +79,8 @@ zend_function_entry http_requestpool_object_fe[] = {
        HTTP_REQPOOL_ME(send, ZEND_ACC_PUBLIC)
        HTTP_REQPOOL_ME(reset, ZEND_ACC_PUBLIC)
 
-       HTTP_REQPOOL_ME(socketSend, ZEND_ACC_PROTECTED)
+       HTTP_REQPOOL_ME(socketPerform, ZEND_ACC_PROTECTED)
        HTTP_REQPOOL_ME(socketSelect, ZEND_ACC_PROTECTED)
-       HTTP_REQPOOL_ME(socketRead, ZEND_ACC_PROTECTED)
 
        /* implements Interator */
        HTTP_REQPOOL_ME(valid, ZEND_ACC_PUBLIC)
@@ -279,29 +277,33 @@ PHP_METHOD(HttpRequestPool, send)
  * Usage:
  * <pre>
  * <?php
- *     while ($pool->socketSend()) {
+ *     while ($pool->socketPerform()) {
  *         do_something_else();
  *         if (!$pool->socketSelect()) {
  *             die('Socket error');
  *         }
  *     }
- *     $pool->socketRead();
  * ?>
  * </pre>
  */
-PHP_METHOD(HttpRequestPool, socketSend)
+PHP_METHOD(HttpRequestPool, socketPerform)
 {
        getObject(http_requestpool_object, obj);
 
        NO_ARGS;
 
-       RETURN_BOOL(0 < http_request_pool_perform(&obj->pool));
+       if (0 < http_request_pool_perform(&obj->pool)) {
+               RETURN_TRUE;
+       } else {
+               zend_llist_apply(&obj->pool.handles, (llist_apply_func_t) http_request_pool_responsehandler TSRMLS_CC);
+               RETURN_FALSE;
+       }
 }
 /* }}} */
 
 /* {{{ proto protected bool HttpRequestPool::socketSelect()
  *
- * See HttpRequestPool::socketSend().
+ * See HttpRequestPool::socketPerform().
  */
 PHP_METHOD(HttpRequestPool, socketSelect)
 {
@@ -313,20 +315,6 @@ PHP_METHOD(HttpRequestPool, socketSelect)
 }
 /* }}} */
 
-/* {{{ proto protected void HttpRequestPool::socketRead()
- *
- * See HttpRequestPool::socketSend().
- */
-PHP_METHOD(HttpRequestPool, socketRead)
-{
-       getObject(http_requestpool_object, obj);
-
-       NO_ARGS;
-
-       zend_llist_apply(&obj->pool.handles, (llist_apply_func_t) http_request_pool_responsehandler TSRMLS_CC);
-}
-/* }}} */
-
 /* implements Iterator */
 
 /* {{{ proto bool HttpRequestPool::valid()
index 7050c4df03f9b925da459798b31a4558459af02e..7a033e1cf42b5ba1a850c256caf7292f61d545e0 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0">
-<!-- $Revision: 1.35 $ -->
+<!-- $Revision: 1.36 $ -->
 <package version="1.0">
   <name>pecl_http</name>
   <summary>Extended HTTP support</summary>
 + Added constants HttpMessage::NONE, Http_Message::REQUEST, HttpMessage::RESPONSE
 + Added Content-Length header if HttpResponse sends full plain entity
 + Added ZendEngine workaround for internal class' static properties (HttpResponse)
++ Added HttpRequestPool::socketPerform()
 
 - Removed http_split_response()
 - Removed AuthBasic hooks
 - Removed HttpResponse::sendHeader(), HttpResponse::sendStatus()
 - Removed HttpRequest::unset*() methods, now handled through set*() with empty parameter
+- Removed HttpRequestPool::socketRead(), HttpRequestPool::socketSend()
 
 * Fixed initialization and cleanup of module globals
 * Fixed builds and tests without libcurl
index d3954f84f68d2baba6c78d65c547be9500b265ca..24c40e0268133b046a2e12a09acf1240f1b0ab08 100644 (file)
@@ -52,9 +52,8 @@ PHP_METHOD(HttpRequestPool, attach);
 PHP_METHOD(HttpRequestPool, detach);
 PHP_METHOD(HttpRequestPool, send);
 PHP_METHOD(HttpRequestPool, reset);
-PHP_METHOD(HttpRequestPool, socketSend);
+PHP_METHOD(HttpRequestPool, socketPerform);
 PHP_METHOD(HttpRequestPool, socketSelect);
-PHP_METHOD(HttpRequestPool, socketRead);
 PHP_METHOD(HttpRequestPool, valid);
 PHP_METHOD(HttpRequestPool, current);
 PHP_METHOD(HttpRequestPool, key);