diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-06-14 02:34:17 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-06-14 02:34:17 +0300 |
commit | fcfa006a4e11a95fb0e717b97164dbd4e23297bf (patch) | |
tree | 04f5a12a83cf3edbb09af72e009ec3fb9c3539eb /ext/mysqlnd/mysqlnd_vio.c | |
parent | bc56bb847d317a46b6d95131da1d6596a19f880c (diff) | |
download | php-git-fcfa006a4e11a95fb0e717b97164dbd4e23297bf.tar.gz |
Avoid useless stream buffer copying and workaround with chunk_size manipulation.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_vio.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_vio.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/mysqlnd/mysqlnd_vio.c b/ext/mysqlnd/mysqlnd_vio.c index 997fbd4d68..50db782be6 100644 --- a/ext/mysqlnd/mysqlnd_vio.c +++ b/ext/mysqlnd/mysqlnd_vio.c @@ -79,14 +79,12 @@ MYSQLND_METHOD(mysqlnd_vio, network_read)(MYSQLND_VIO * const vio, zend_uchar * { enum_func_status return_value = PASS; php_stream * net_stream = vio->data->m.get_stream(vio); - size_t old_chunk_size = net_stream->chunk_size; size_t to_read = count, ret; zend_uchar * p = buffer; DBG_ENTER("mysqlnd_vio::network_read"); DBG_INF_FMT("count="MYSQLND_SZ_T_SPEC, count); - net_stream->chunk_size = MIN(to_read, vio->data->options.net_read_buffer_size); while (to_read) { if (!(ret = php_stream_read(net_stream, (char *) p, to_read))) { DBG_ERR_FMT("Error while reading header from socket"); @@ -97,7 +95,6 @@ MYSQLND_METHOD(mysqlnd_vio, network_read)(MYSQLND_VIO * const vio, zend_uchar * to_read -= ret; } MYSQLND_INC_CONN_STATISTIC_W_VALUE(stats, STAT_BYTES_RECEIVED, count - to_read); - net_stream->chunk_size = old_chunk_size; DBG_RETURN(return_value); } /* }}} */ @@ -265,6 +262,8 @@ MYSQLND_METHOD(mysqlnd_vio, post_connect_set_opt)(MYSQLND_VIO * const vio, const /* TCP -> Set SO_KEEPALIVE */ mysqlnd_set_sock_keepalive(net_stream); } + + net_stream->chunk_size = vio->data->options.net_read_buffer_size; } DBG_VOID_RETURN; |