You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2021/09/03 19:48:57 UTC

[GitHub] [qpid-dispatch] kgiusti commented on a change in pull request #1343: DISPATCH-2232: Combine output buffers and delay sending them so that …

kgiusti commented on a change in pull request #1343:
URL: https://github.com/apache/qpid-dispatch/pull/1343#discussion_r702129006



##########
File path: src/adaptors/http2/http2_adaptor.c
##########
@@ -608,55 +594,72 @@ static int snd_data_callback(nghttp2_session *session,
     qdr_http2_connection_t *conn = (qdr_http2_connection_t *)user_data;
     qdr_http2_stream_data_t *stream_data = (qdr_http2_stream_data_t *)source->ptr;
 
-    qd_log(http2_adaptor->protocol_log_source, QD_LOG_TRACE, "[C%"PRIu64"][S%"PRId32"] snd_data_callback length=%zu", conn->conn_id, stream_data->stream_id, length);
+    qd_log(http2_adaptor->protocol_log_source, QD_LOG_TRACE, "[C%"PRIu64"][S%"PRId32"] send_data_callback length=%zu", conn->conn_id, stream_data->stream_id, length);
 
     int bytes_sent = 0; // This should not include the header length of 9.
     bool write_buffs = false;
     if (length) {
-        write_buffs = true;
-        qd_http2_buffer_t *http2_buff = qd_http2_buffer();
-        DEQ_INSERT_TAIL(conn->buffs, http2_buff);
-        // Insert the framehd of length 9 bytes into the buffer
-        memcpy(qd_http2_buffer_cursor(http2_buff), framehd, HTTP2_DATA_FRAME_HEADER_LENGTH);
-        qd_http2_buffer_insert(http2_buff, HTTP2_DATA_FRAME_HEADER_LENGTH);
-
-        uint32_t octets_remaining = qd_iterator_remaining(stream_data->curr_stream_data_iter);
-
-        size_t len = MIN(octets_remaining, length);
-        int copied = qd_iterator_ncopy(stream_data->curr_stream_data_iter, qd_http2_buffer_cursor(http2_buff), len);
-        assert(copied == len);
-        qd_http2_buffer_insert(http2_buff, len);
-        octets_remaining -= copied;
-        bytes_sent += copied;
-        qd_iterator_trim_view(stream_data->curr_stream_data_iter, octets_remaining);
+        qd_http2_buffer_t *tail_buff = qd_http2_buffer_list_append(&(conn->buffs), framehd, HTTP2_DATA_FRAME_HEADER_LENGTH);
+        size_t tail_buff_capacity = qd_http2_buffer_capacity(tail_buff);
+        if (tail_buff_capacity == 0) {
+            tail_buff = qd_http2_buffer();
+            DEQ_INSERT_TAIL(conn->buffs, tail_buff);
+            tail_buff_capacity = qd_http2_buffer_capacity(tail_buff);
+        }
+        size_t bytes_to_write = length;
+        while (bytes_to_write > 0) {
+            uint32_t octets_remaining = qd_iterator_remaining(stream_data->curr_stream_data_iter);
+            qd_log(http2_adaptor->protocol_log_source, QD_LOG_TRACE, "[C%"PRIu64"][S%"PRId32"] send_data_callback octets_remaining=%"PRId32", tail_buff_capacity=%zu, bytes_to_write==%zu", conn->conn_id, stream_data->stream_id, octets_remaining, tail_buff_capacity, bytes_to_write);

Review comment:
       This log can potentially put quite a load on the trace output.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org