A few comments after a quick look at the code:

1)
    int errorno;
..
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsss|z", &errorno,

the "l" modifier in parse_parameters expects long, not int.
But string lengths are int. It's a bit counterintuitive, yes.

2) zend_error() is for Zend Engine only and should never be called from an 
extension, use php_error_docref() instead
3) E_ERROR should only be used if the engine cannot continue execution, using 
it for errors in an extension is definitely an overkill
4) there are quite a lot of debug/error printfs in the code
5) I do not think this is the best way to determine if there were any errors:

  char *p = strstr(Z_STRVAL_P(str), "server has gone away");
  char *p2 = strstr(Z_STRVAL_P(str), "There is already an active transaction");
  if (p || p2) {
      zend_hash_del(&pdo_object_table, Z_STRVAL_PP(data_source), 
Z_STRLEN_PP(data_source));
  }


All in all, the extension looks like a hack to me, I don't believe this should 
be in PECL.


On 01/15/2015 05:18 AM, guo xinhua wrote:
I have writen a php extension and i want publish to pecl.

The extension start a proxy process and hold some pdo and redis connections,
It provide local connect pool like java.


Technical characteristics:

- After each time fetchAll (set/get)  call release() method, release
the connection to the pool, avoid that the script jammed causing
connection occupy high.
- The maximum and minimum number of connections configuration support.
- Support  small pressure automatic recovery connection.
- Support graceful restart (reload).
- Do a lot of optimization, although the request through the
connection pool process forward, but no loss of QPS.
- When the connection use out,support queue.
- Simple! just change the new method and add release function (see
demon),you used the tcp pool.
- The connection proxy will start the ping process to monitor down
list, if available will reflect to the return value of the
get_disable_list(), use this function you can do some fun things,like
LB.

The code on git:
github.com/swoole/php-cp


I am Gray,25 years old,live in china , my chinese name is xinhua.guo,
i work on jumei.


btw:I have translate the conf,demon.php and readme.



--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to