Hi,

Le 30/10/2015 17:15, [email protected] 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

Reply via email to