ganeshmurthy commented on a change in pull request #1301:
URL: https://github.com/apache/qpid-dispatch/pull/1301#discussion_r673484087
##########
File path: src/adaptors/http2/http2_adaptor.c
##########
@@ -770,63 +856,102 @@ static bool compose_and_deliver(qdr_http2_connection_t
*conn, qdr_http2_stream_d
if (!stream_data->header_and_props_composed) {
qd_composed_field_t *header_and_props = 0;
if (conn->ingress) {
- header_and_props = qd_message_compose_amqp(stream_data->message,
- conn->config->address, //
const char *to
- 0, //
const char *subject
- stream_data->reply_to, //
const char *reply_to
- 0, //
const char *content_type
- 0, //
const char *content_encoding
- 0, //
int32_t correlation_id
- conn->config->site);
+ header_and_props = qd_message_compose_amqp(conn,
+ stream_data->message,
+ conn->config->address, // const char
*to
+ 0, // const char
*subject
+ stream_data->reply_to, // const char
*reply_to
+ 0, // const char
*content_type
+ 0, // const char
*content_encoding
+ 0, // int32_t
correlation_id
+ conn->config->site);
}
else {
- header_and_props = qd_message_compose_amqp(stream_data->message,
- stream_data->reply_to, //
const char *to
- 0, //
const char *subject
- 0, //
const char *reply_to
- 0, //
const char *content_type
- 0, //
const char *content_encoding
- 0, //
int32_t correlation_id
- conn->config->site);
+ header_and_props = qd_message_compose_amqp(conn,
+ stream_data->message,
+ stream_data->reply_to, // const char *to
+ 0, // const char
*subject
+ 0, // const char
*reply_to
+ 0, // const char
*content_type
+ 0, // const char
*content_encoding
+ 0, // int32_t
correlation_id
+ conn->config->site);
}
if (receive_complete) {
qd_log(http2_adaptor->log_source, QD_LOG_TRACE,
"[C%"PRIu64"][S%"PRId32"][L%"PRIu64"] receive_complete = true in
compose_and_deliver", conn->conn_id, stream_data->stream_id,
stream_data->in_link->identity);
- if (!stream_data->body) {
- stream_data->body = qd_compose(QD_PERFORMATIVE_BODY_DATA, 0);
- qd_compose_insert_binary(stream_data->body, 0, 0);
- qd_log(http2_adaptor->log_source, QD_LOG_TRACE,
"[C%"PRIu64"][S%"PRId32"] Inserting empty body data in compose_and_deliver",
conn->conn_id, stream_data->stream_id);
- }
-
+ bool q2_blocked;
if (stream_data->footer_properties) {
- qd_message_compose_5(stream_data->message, header_and_props,
stream_data->app_properties, stream_data->body, stream_data->footer_properties,
receive_complete);
+ qd_message_compose_3(stream_data->message, header_and_props,
stream_data->app_properties, receive_complete);
+ qd_message_stream_data_append(stream_data->message,
&stream_data->body_buffers, &q2_blocked);
+ stream_data->body_data_added_to_msg = true;
+
+ qd_buffer_list_t existing_buffers;
+ DEQ_INIT(existing_buffers);
+ qd_compose_take_buffers(stream_data->footer_properties,
&existing_buffers);
+ qd_message_stream_data_footer_append(stream_data->message,
&existing_buffers);
}
else {
- qd_message_compose_4(stream_data->message, header_and_props,
stream_data->app_properties, stream_data->body, receive_complete);
+ qd_message_compose_3(stream_data->message, header_and_props,
stream_data->app_properties, receive_complete);
+ qd_message_stream_data_append(stream_data->message,
&stream_data->body_buffers, &q2_blocked);
+ stream_data->body_data_added_to_msg = true;
}
+
+ conn->q2_blocked = conn->q2_blocked || q2_blocked;
+ if (conn->q2_blocked) {
+ qd_log(http2_adaptor->protocol_log_source,
QD_LOG_TRACE, "[C%"PRIu64"] q2 is blocked on this connection", conn->conn_id);
+ }
}
else {
- if (stream_data->body) {
- qd_log(http2_adaptor->log_source, QD_LOG_TRACE,
"[C%"PRIu64"][S%"PRId32"][L%"PRIu64"] receive_complete = false and has
stream_data->body in compose_and_deliver", conn->conn_id,
stream_data->stream_id, stream_data->in_link->identity);
+ if (DEQ_SIZE(stream_data->body_buffers) > 0) {
+ qd_log(http2_adaptor->log_source, QD_LOG_TRACE,
"[C%"PRIu64"][S%"PRId32"][L%"PRIu64"] receive_complete = false and has
stream_data->body_buffers in compose_and_deliver", conn->conn_id,
stream_data->stream_id, stream_data->in_link->identity);
+ bool q2_blocked;
if (stream_data->footer_properties) {
- qd_message_compose_5(stream_data->message,
header_and_props, stream_data->app_properties, stream_data->body,
stream_data->footer_properties, receive_complete);
+ if (!stream_data->entire_footer_arrived) {
+ qd_compose_free(header_and_props);
+ return false;
+ }
+
+ qd_message_compose_3(stream_data->message,
header_and_props, stream_data->app_properties, receive_complete);
+ qd_message_stream_data_append(stream_data->message,
&stream_data->body_buffers, &q2_blocked);
+ qd_buffer_list_t existing_buffers;
+ DEQ_INIT(existing_buffers);
+ qd_compose_take_buffers(stream_data->footer_properties,
&existing_buffers);
+ qd_message_stream_data_footer_append(stream_data->message,
&existing_buffers);
}
else {
- qd_message_compose_4(stream_data->message,
header_and_props, stream_data->app_properties, stream_data->body,
receive_complete);
+ qd_message_compose_3(stream_data->message,
header_and_props, stream_data->app_properties, receive_complete);
+ qd_message_stream_data_append(stream_data->message,
&stream_data->body_buffers, &q2_blocked);
}
- stream_data->body_data_added = true;
+ stream_data->body_data_added_to_msg = true;
+ conn->q2_blocked = conn->q2_blocked || q2_blocked;
+ if (conn->q2_blocked) {
+ qd_log(http2_adaptor->protocol_log_source,
QD_LOG_TRACE, "[C%"PRIu64"] q2 is blocked on this connection", conn->conn_id);
+ }
}
else {
-
if (stream_data->footer_properties) {
+
+ if (!stream_data->entire_footer_arrived) {
+ qd_compose_free(header_and_props);
+ return false;
+ }
+
//
// The footer has already arrived but there was no body.
Insert an empty body
//
- stream_data->body = qd_compose(QD_PERFORMATIVE_BODY_DATA,
0);
- qd_message_compose_5(stream_data->message,
header_and_props, stream_data->app_properties, stream_data->body,
stream_data->footer_properties, receive_complete);
+ qd_message_compose_3(stream_data->message,
header_and_props, stream_data->app_properties, receive_complete);
+ qd_message_stream_data_append(stream_data->message,
&stream_data->body_buffers, 0);
Review comment:
In this specific case the entire footer has arrived but there is no body
(DEQ_SIZE(stream_data->body_buffers) == 0)
We are simply calling the qd_message_stream_data_append() to insert an empty
body. This will not trigger q2. Then we call
qd_message_stream_data_footer_append() to append the footer.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]