andrey Wed, 15 Dec 2010 14:14:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=306386
Log: count preciser in case of error Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c 2010-12-15 13:47:14 UTC (rev 306385) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c 2010-12-15 14:14:58 UTC (rev 306386) @@ -64,6 +64,7 @@ static enum_func_status MYSQLND_METHOD(mysqlnd_net, network_read)(MYSQLND * conn, zend_uchar * buffer, size_t count TSRMLS_DC) { + enum_func_status return_value = PASS; size_t to_read = count, ret; size_t old_chunk_size = conn->net->stream->chunk_size; DBG_ENTER("mysqlnd_net::network_read"); @@ -72,14 +73,15 @@ while (to_read) { if (!(ret = php_stream_read(conn->net->stream, (char *) buffer, to_read))) { DBG_ERR_FMT("Error while reading header from socket"); - DBG_RETURN(FAIL); + return_value = FAIL; + break; } buffer += ret; to_read -= ret; } - MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_BYTES_RECEIVED, count); + MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_BYTES_RECEIVED, count - to_read); conn->net->stream->chunk_size = old_chunk_size; - DBG_RETURN(PASS); + DBG_RETURN(return_value); } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-12-15 13:47:14 UTC (rev 306385) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-12-15 14:14:58 UTC (rev 306386) @@ -64,6 +64,7 @@ static enum_func_status MYSQLND_METHOD(mysqlnd_net, network_read)(MYSQLND * conn, zend_uchar * buffer, size_t count TSRMLS_DC) { + enum_func_status return_value = PASS; size_t to_read = count, ret; size_t old_chunk_size = conn->net->stream->chunk_size; DBG_ENTER("mysqlnd_net::network_read"); @@ -72,14 +73,15 @@ while (to_read) { if (!(ret = php_stream_read(conn->net->stream, (char *) buffer, to_read))) { DBG_ERR_FMT("Error while reading header from socket"); - DBG_RETURN(FAIL); + return_value = FAIL; + break; } buffer += ret; to_read -= ret; } - MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_BYTES_RECEIVED, count); + MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_BYTES_RECEIVED, count - to_read); conn->net->stream->chunk_size = old_chunk_size; - DBG_RETURN(PASS); + DBG_RETURN(return_value); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php