httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe JAILLET <christophe.jail...@wanadoo.fr>
Subject Re: svn commit: r1711503 - in /httpd/httpd/trunk/modules/http2: h2_conn_io.c h2_conn_io.h h2_io.c h2_io.h h2_mplx.c h2_mplx.h h2_session.c h2_stream.c h2_stream.h h2_task_input.c h2_util.c h2_util.h
Date Sun, 01 Nov 2015 07:22:20 GMT
Hi,

Le 30/10/2015 17:15, icing@apache.org a écrit :
> Author: icing
> Date: Fri Oct 30 16:15:40 2015
> New Revision: 1711503
>
> URL: http://svn.apache.org/viewvc?rev=1711503&view=rev
> Log:
> improved h2c write performance
>
> [...]
> +static char immortal_zeros[256];
> +
>   static int on_send_data_cb(nghttp2_session *ngh2,
>                              nghttp2_frame *frame,
>                              const uint8_t *framehd,
> @@ -563,30 +557,59 @@ static int on_send_data_cb(nghttp2_sessi
>                     "h2_stream(%ld-%d): send_data_cb for %ld bytes",
>                     session->id, (int)stream_id, (long)length);
>                     
> -    status = send_data(session, (const char *)framehd, 9);
> -    if (status == APR_SUCCESS) {
> +    if (h2_conn_io_is_buffered(&session->io)) {
> +        status = h2_conn_io_write(&session->io, (const char *)framehd, 9);
> +        if (status == APR_SUCCESS) {
> +            if (padlen) {
> +                status = h2_conn_io_write(&session->io, (const char *)&padlen,
1);
> +            }
> +
> +            if (status == APR_SUCCESS) {
> +                apr_size_t len = length;
> +                status = h2_stream_readx(stream, pass_data, session,
> +                                         &len, &eos);
> +                if (status == APR_SUCCESS && len != length) {
> +                    status = APR_EINVAL;
> +                }
> +            }
> +
> +            if (status == APR_SUCCESS && padlen) {
> +                if (padlen) {
> +                    char pad[256];
> +                    memset(pad, 0, padlen);

You could save this 'pad' buffer and the 'memset' by also using the data 
from the 'static char immortal_zeros[256];' introduced above.

Maybe, using NGHTTP2_MAX_PADLEN instead of the 256 hard coded value 
would be cleaner?

CJ

Mime
View raw message