|
|
|
@ -1225,6 +1225,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, reap_query)(MYSQLND_CONN_DATA * conn TSRMLS_DC |
|
|
|
|
|
|
|
#include "php_network.h" |
|
|
|
|
|
|
|
/* {{{ mysqlnd_stream_array_to_fd_set */ |
|
|
|
MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS_DC) |
|
|
|
{ |
|
|
|
int cnt = 0; |
|
|
|
@ -1255,15 +1256,17 @@ MYSQLND ** mysqlnd_stream_array_check_for_readiness(MYSQLND ** conn_array TSRMLS |
|
|
|
} |
|
|
|
return ret; |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
|
|
|
|
/* {{{ stream_select mysqlnd_stream_array_to_fd_set functions */ |
|
|
|
/* {{{ mysqlnd_stream_array_to_fd_set */ |
|
|
|
static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, php_socket_t * max_fd TSRMLS_DC) |
|
|
|
{ |
|
|
|
php_socket_t this_fd; |
|
|
|
php_stream *stream = NULL; |
|
|
|
int cnt = 0; |
|
|
|
unsigned int cnt = 0; |
|
|
|
MYSQLND **p = conn_array; |
|
|
|
DBG_ENTER("mysqlnd_stream_array_to_fd_set"); |
|
|
|
|
|
|
|
while (*p) { |
|
|
|
/* get the fd. |
|
|
|
@ -1272,6 +1275,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p |
|
|
|
* is not displayed. |
|
|
|
* */ |
|
|
|
stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC); |
|
|
|
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream); |
|
|
|
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, |
|
|
|
(void*)&this_fd, 1) && this_fd >= 0) { |
|
|
|
|
|
|
|
@ -1284,21 +1288,24 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p |
|
|
|
} |
|
|
|
p++; |
|
|
|
} |
|
|
|
return cnt ? 1 : 0; |
|
|
|
DBG_RETURN(cnt ? 1 : 0); |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
|
|
|
|
/* {{{ mysqlnd_stream_array_from_fd_set */ |
|
|
|
static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds TSRMLS_DC) |
|
|
|
{ |
|
|
|
php_socket_t this_fd; |
|
|
|
php_stream *stream = NULL; |
|
|
|
int ret = 0; |
|
|
|
zend_bool disproportion = FALSE; |
|
|
|
|
|
|
|
|
|
|
|
MYSQLND **fwd = conn_array, **bckwd = conn_array; |
|
|
|
DBG_ENTER("mysqlnd_stream_array_from_fd_set"); |
|
|
|
|
|
|
|
while (*fwd) { |
|
|
|
stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC); |
|
|
|
DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream); |
|
|
|
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, |
|
|
|
(void*)&this_fd, 1) && this_fd >= 0) { |
|
|
|
if (PHP_SAFE_FD_ISSET(this_fd, fds)) { |
|
|
|
@ -1316,7 +1323,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds |
|
|
|
} |
|
|
|
*bckwd = NULL;/* NULL-terminate the list */ |
|
|
|
|
|
|
|
return ret; |
|
|
|
DBG_RETURN(ret); |
|
|
|
} |
|
|
|
/* }}} */ |
|
|
|
|
|
|
|
|