You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2021/03/26 00:21:08 UTC
[qpid-dispatch] branch master updated: DISPATCH-2008: Remove
previous server parameters. Fixed code to send out final DATA frame with a
flag even if it has no data
This is an automated email from the ASF dual-hosted git repository.
gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 9b01fa6 DISPATCH-2008: Remove previous server parameters. Fixed code to send out final DATA frame with a flag even if it has no data
9b01fa6 is described below
commit 9b01fa699ebb91a477949974aa028764b2e5e158
Author: Ganesh Murthy <gm...@apache.org>
AuthorDate: Thu Mar 25 20:20:53 2021 -0400
DISPATCH-2008: Remove previous server parameters. Fixed code to send out final DATA frame with a flag even if it has no data
---
src/adaptors/http2/http2_adaptor.c | 20 +++++++++++++++++++-
src/adaptors/http2/http2_adaptor.h | 1 +
tests/system_tests_grpc.py | 6 +-----
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/adaptors/http2/http2_adaptor.c b/src/adaptors/http2/http2_adaptor.c
index 99bc70b..fe9c95a 100644
--- a/src/adaptors/http2/http2_adaptor.c
+++ b/src/adaptors/http2/http2_adaptor.c
@@ -539,7 +539,9 @@ static int snd_data_callback(nghttp2_session *session,
qdr_http2_stream_data_t *stream_data = (qdr_http2_stream_data_t *)source->ptr;
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(session_data->buffs, http2_buff);
// Insert the framehd of length 9 bytes into the buffer
@@ -569,6 +571,15 @@ static int snd_data_callback(nghttp2_session *session,
idx += 1;
}
}
+ else if (length == 0 && stream_data->out_msg_data_flag_eof) {
+ write_buffs = true;
+ qd_http2_buffer_t *http2_buff = qd_http2_buffer();
+ DEQ_INSERT_TAIL(session_data->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);
+ }
+
if (stream_data->full_payload_handled) {
if (!stream_data->out_msg_has_footer && stream_data->curr_stream_data) {
qd_message_stream_data_release(stream_data->curr_stream_data);
@@ -585,9 +596,11 @@ static int snd_data_callback(nghttp2_session *session,
if (length) {
assert(bytes_sent == length);
- write_buffers(conn);
}
+ if (write_buffs)
+ write_buffers(conn);
+
return 0;
}
@@ -1112,6 +1125,7 @@ ssize_t read_data_callback(nghttp2_session *session,
}
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
+ stream_data->out_msg_data_flag_eof = true;
stream_data->out_msg_body_sent = true;
stream_data->full_payload_handled = true;
if (stream_data->next_stream_data) {
@@ -1155,6 +1169,7 @@ ssize_t read_data_callback(nghttp2_session *session,
stream_data->next_stream_data_result = qd_message_next_stream_data(message, &stream_data->next_stream_data);
if (stream_data->next_stream_data_result == QD_MESSAGE_STREAM_DATA_NO_MORE) {
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
+ stream_data->out_msg_data_flag_eof = true;
stream_data->out_msg_body_sent = true;
if (stream_data->next_stream_data) {
qd_message_stream_data_release(stream_data->next_stream_data);
@@ -1222,6 +1237,7 @@ ssize_t read_data_callback(nghttp2_session *session,
else {
stream_data->qd_buffers_to_send = 0;
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
+ stream_data->out_msg_data_flag_eof = true;
if (stream_data->out_msg_has_footer) {
//
// We have to send the trailer fields.
@@ -1232,6 +1248,7 @@ ssize_t read_data_callback(nghttp2_session *session,
// END_STREAM in DATA frame.
//
*data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
+ qd_log(http2_adaptor->protocol_log_source, QD_LOG_TRACE, "[C%"PRIu64"][S%"PRId32"] read_data_callback stream_data->out_msg_has_footer, setting NGHTTP2_DATA_FLAG_NO_END_STREAM", conn->conn_id, stream_data->stream_id);
}
stream_data->full_payload_handled = true;
stream_data->out_msg_body_sent = true;
@@ -1247,6 +1264,7 @@ ssize_t read_data_callback(nghttp2_session *session,
// The body-data is corrupt in some way. Stop handling the delivery and reject it.
//
*data_flags |= NGHTTP2_DATA_FLAG_EOF;
+ stream_data->out_msg_data_flag_eof = true;
if (stream_data->curr_stream_data)
qd_message_stream_data_release(stream_data->curr_stream_data);
stream_data->curr_stream_data = 0;
diff --git a/src/adaptors/http2/http2_adaptor.h b/src/adaptors/http2/http2_adaptor.h
index 39b1767..fc0a729 100644
--- a/src/adaptors/http2/http2_adaptor.h
+++ b/src/adaptors/http2/http2_adaptor.h
@@ -103,6 +103,7 @@ struct qdr_http2_stream_data_t {
bool use_footer_properties;
bool full_payload_handled; // applies to the sending side.
bool out_msg_has_body;
+ bool out_msg_data_flag_eof;
bool out_msg_has_footer;
bool out_msg_send_complete; // we use this flag to save the send_complete flag because the delivery and message associated with this stream might have been freed.
bool disp_updated; // Has the disposition already been set on the out_dlv
diff --git a/tests/system_tests_grpc.py b/tests/system_tests_grpc.py
index 19044b7..eed9aa3 100644
--- a/tests/system_tests_grpc.py
+++ b/tests/system_tests_grpc.py
@@ -91,11 +91,7 @@ class GrpcServiceMethodsTest(TestCase):
cls.grpc_server_port = str(cls.tester.get_port())
# Run the gRPC server (see friendship.proto for more info)
- cls.grpc_server = fs.serve(cls.grpc_server_port,
- options=(('grpc.http2.max_ping_strikes', 100),
- ('grpc.http2.max_pings_without_data', 100),
- ('grpc.keepalive_permit_without_calls', True),
- ))
+ cls.grpc_server = fs.serve(cls.grpc_server_port)
# Prepare router to communicate with the gRPC server
cls.connector_props = {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org