diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/channel/channel_args.h | 2 | ||||
-rw-r--r-- | src/core/lib/channel/message_size_filter.c | 13 | ||||
-rw-r--r-- | src/cpp/server/server_builder.cc | 4 |
3 files changed, 8 insertions, 11 deletions
diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 71fde5ad7e..586a296d1f 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -89,12 +89,12 @@ uint32_t grpc_channel_args_compression_algorithm_get_states( int grpc_channel_args_compare(const grpc_channel_args *a, const grpc_channel_args *b); -/** Returns the value of \a arg, subject to the contraints in \a options. */ typedef struct grpc_integer_options { int default_value; // Return this if value is outside of expected bounds. int min_value; int max_value; } grpc_integer_options; +/** Returns the value of \a arg, subject to the contraints in \a options. */ int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options); #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/lib/channel/message_size_filter.c index e2d7ff795c..f8bb1134ec 100644 --- a/src/core/lib/channel/message_size_filter.c +++ b/src/core/lib/channel/message_size_filter.c @@ -70,17 +70,15 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data, (*calld->recv_message)->length > chand->max_recv_size) { char* message_string; gpr_asprintf(&message_string, - "Received message larger than max (%lu vs. %lu)", - (unsigned long)(*calld->recv_message)->length, - (unsigned long)chand->max_recv_size); + "Received message larger than max (%u vs. %zu)", + (*calld->recv_message)->length, chand->max_recv_size); gpr_slice message = gpr_slice_from_copied_string(message_string); gpr_free(message_string); grpc_call_element_send_cancel_with_message( exec_ctx, elem, GRPC_STATUS_INVALID_ARGUMENT, &message); } // Invoke the next callback. - calld->next_recv_message_ready->cb( - exec_ctx, calld->next_recv_message_ready->cb_arg, error); + grpc_exec_ctx_sched(exec_ctx, calld->next_recv_message_ready, error, NULL); } // Start transport op. @@ -93,9 +91,8 @@ static void start_transport_stream_op(grpc_exec_ctx* exec_ctx, if (op->send_message != NULL && op->send_message->length > chand->max_send_size) { char* message_string; - gpr_asprintf(&message_string, "Sent message larger than max (%lu vs. %lu)", - (unsigned long)op->send_message->length, - (unsigned long)chand->max_send_size); + gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %zu)", + op->send_message->length, chand->max_send_size); gpr_slice message = gpr_slice_from_copied_string(message_string); gpr_free(message_string); grpc_call_element_send_cancel_with_message( diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 960ebd640d..2980b16c56 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -162,10 +162,10 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { } (*plugin)->UpdateChannelArguments(&args); } - if (max_receive_message_size_ > 0) { + if (max_receive_message_size_ >= 0) { args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_); } - if (max_send_message_size_ > 0) { + if (max_send_message_size_ >= 0) { args.SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, max_send_message_size_); } args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, |