Commits

Ruslan Osmanov  committed 9680a38

Add: EventBufferEvent::$priority property
Fix: event and bevent free methods

  • Participants
  • Parent commits af406b9

Comments (0)

Files changed (16)

File classes/base.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto EventBase EventBase::__construct([EventConfig cfg = null]); */
 PHP_METHOD(EventBase, __construct)

File classes/buffer.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto resource EventBuffer::__construct(void); */
 PHP_METHOD(EventBuffer, __construct)

File classes/buffer_event.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ Private */
 
 	if (bev->bevent) {
 		bufferevent_free(bev->bevent);
 		bev->bevent = 0;
-	}
 
-	zval_ptr_dtor(&zbevent);
+		/* Do it once */
+		Z_DELREF_P(zbevent);
+		/*zval_ptr_dtor(&zbevent);*/
+	}
 }
 /* }}} */
 

File classes/dns.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto EventDnsBase EventDnsBase::__construct(EventBase base, bool initialize);
  *

File classes/event.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ Private */
 
 		e->event = NULL;
 	}
 
-	zval_ptr_dtor(&zself);
+	/*zval_ptr_dtor(&zself);*/
 }
 /* }}} */
 

File classes/event_config.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto EventConfig::__construct(void);
  * On success returns a valid resource representing an event configuration

File classes/event_util.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto int EventUtil::getLastSocketErrno([mixed socket = null]);
  *

File classes/http.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto EventHttp EventHttp::__construct(EventBase base);
  *

File classes/http_connection.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ proto EventHttpConnection EventHttpConnection::__construct(EventBase base, EventDnsBase dns_base, string address, int port);
  * */

File classes/listener.c

    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /* {{{ Private */
 
     <email>osmanov@php.net</email>
     <active>yes</active>
   </lead>
-  <date>2013-02-01</date>
+  <date>2013-02-03</date>
   <!--{{{ Current version -->
   <version>
     <release>1.1.0</release>
    +----------------------------------------------------------------------+
 */
 
-#include "common.h"
-#include "util.h"
-#include "priv.h"
+#include "src/common.h"
+#include "src/util.h"
+#include "src/priv.h"
 
 /*
 ZEND_DECLARE_MODULE_GLOBALS(event)
 */
 
 #include "fe.h"
-#include "priv.h"
+#include "src/priv.h"
 
 /* {{{ ARGINFO */
 ZEND_BEGIN_ARG_INFO(arginfo_event__void, 0)
 #ifndef PHP_EVENT_FE_H
 #define PHP_EVENT_FE_H
 
-#include "common.h"
+#include "src/common.h"
 
 PHP_METHOD(Event, __construct);
 PHP_METHOD(Event, free);
    | Author: Ruslan Osmanov <osmanov@php.net>                             |
    +----------------------------------------------------------------------+
 */
-#include "common.h"
-#include "priv.h"
-#include "util.h"
+#include "src/common.h"
+#include "src/priv.h"
+#include "src/util.h"
 
 /* {{{ event_timer_pending_prop_read */
 static int event_timer_pending_prop_read(php_event_abstract_object_t *obj, zval **retval TSRMLS_DC)
 }
 /* }}} */
 
+/* {{{ event_bevent_priority_write */
+static int event_bevent_priority_write(php_event_abstract_object_t *obj, zval *value TSRMLS_DC)
+{
+	php_event_bevent_t *bev = (php_event_bevent_t *) obj;
+	long priority           = Z_LVAL_P(value);
+
+	if (bufferevent_priority_set(bev->bevent, priority)) {
+		return FAILURE;
+	}
+	return SUCCESS;
+}
+/* }}} */
+
 
 const php_event_property_entry_t event_property_entries[] = {
 	{"timer_pending",           sizeof("timer_pending") - 1, event_timer_pending_prop_read, NULL, NULL},
     {NULL, 0, NULL, NULL, NULL}
 };
 const php_event_property_entry_t event_bevent_property_entries[] = {
+	{"priority", sizeof("priority") - 1, NULL, event_bevent_priority_write, NULL},
     {NULL, 0, NULL, NULL, NULL}
 };
 const php_event_property_entry_t event_buffer_property_entries[] = {
 	{0, NULL, 0, -1, 0, NULL, 0, NULL}
 };
 const zend_property_info event_bevent_property_entry_info[] = {
+	{ZEND_ACC_PUBLIC, "priority", sizeof("priority") - 1, -1, 0, NULL, 0, NULL},
 	{0, NULL, 0, -1, 0, NULL, 0, NULL}
 };
 const zend_property_info event_buffer_property_entry_info[] = {
    +----------------------------------------------------------------------+
 */
 
-#include "common.h"
-#include "util.h"
+#include "src/common.h"
+#include "src/util.h"
 
 /* {{{ php_event_is_pending 
 Don't allow for pending or active event