Merge remote-tracking branch 'upstream/master' into deadline_filter

pull/7970/head
Mark D. Roth 8 years ago
commit 94948b8774
  1. 2
      doc/core/pending_api_cleanups.md
  2. 2
      include/grpc++/ext/reflection.grpc.pb.h
  3. 2
      include/grpc++/ext/reflection.pb.h
  4. 6
      include/grpc/impl/codegen/grpc_types.h
  5. 2
      src/core/ext/lb_policy/pick_first/pick_first.c
  6. 2
      src/core/ext/lb_policy/round_robin/round_robin.c
  7. 42
      src/core/lib/channel/message_size_filter.c
  8. 2
      src/cpp/ext/reflection.grpc.pb.cc
  9. 2
      src/cpp/ext/reflection.pb.cc
  10. 1
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  11. 3
      src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
  12. 32
      tools/codegen/extensions/gen_reflection_proto.sh

@ -13,3 +13,5 @@ number:
- remove `GRPC_ARG_MAX_MESSAGE_LENGTH` channel arg from
`include/grpc/impl/codegen/grpc_types.h` (commit `af00d8b`)
- remove `ServerBuilder::SetMaxMessageSize()` method from
`include/grpc++/server_builder.h` (commit `6980362`)

@ -32,7 +32,7 @@
*/
// Generated by the gRPC protobuf plugin.
// Generated by tools/codegen/extensions/gen_reflection_proto.sh
// If you make any local change, they will be lost.
// source: reflection.proto
// Original file comments:

@ -32,7 +32,7 @@
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// Generated by tools/codegen/extensions/gen_reflection_proto.sh
// source: reflection.proto
#ifndef PROTOBUF_reflection_2eproto__INCLUDED

@ -148,11 +148,13 @@ typedef struct {
/** Maximum number of concurrent incoming streams to allow on a http2
connection. Int valued. */
#define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams"
/** Maximum message length that the channel can receive. Int valued, bytes. */
/** Maximum message length that the channel can receive. Int valued, bytes.
-1 means unlimited. */
#define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length"
/** \deprecated For backward compatibility. */
#define GRPC_ARG_MAX_MESSAGE_LENGTH GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
/** Maximum message length that the channel can send. Int valued, bytes. */
/** Maximum message length that the channel can send. Int valued, bytes.
-1 means unlimited. */
#define GRPC_ARG_MAX_SEND_MESSAGE_LENGTH "grpc.max_send_message_length"
/** Initial sequence number for http2 transports. Int valued. */
#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \

@ -472,6 +472,8 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
}
memset(&sc_args, 0, sizeof(grpc_subchannel_args));
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of args->server_name (a borrowed pointer) OK. */
sc_args.server_name = args->server_name;
sc_args.addr =
(struct sockaddr *)(&args->addresses->addresses[i].address.addr);

@ -635,6 +635,8 @@ static grpc_lb_policy *round_robin_create(grpc_exec_ctx *exec_ctx,
if (args->addresses->addresses[i].is_balancer) continue;
memset(&sc_args, 0, sizeof(grpc_subchannel_args));
/* server_name will be copied as part of the subchannel creation. This makes
* the copying of args->server_name (a borrowed pointer) OK. */
sc_args.server_name = args->server_name;
sc_args.addr =
(struct sockaddr *)(&args->addresses->addresses[i].address.addr);

@ -40,8 +40,9 @@
#include "src/core/lib/channel/channel_args.h"
#define DEFAULT_MAX_SEND_MESSAGE_LENGTH -1 // Unlimited.
// The protobuf library will (by default) start warning at 100 megs.
#define DEFAULT_MAX_MESSAGE_LENGTH (4 * 1024 * 1024)
#define DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024)
typedef struct call_data {
// Receive closures are chained: we inject this closure as the
@ -55,8 +56,8 @@ typedef struct call_data {
} call_data;
typedef struct channel_data {
size_t max_send_size;
size_t max_recv_size;
int max_send_size;
int max_recv_size;
} channel_data;
// Callback invoked when we receive a message. Here we check the max
@ -66,12 +67,12 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_call_element* elem = user_data;
call_data* calld = elem->call_data;
channel_data* chand = elem->channel_data;
if (*calld->recv_message != NULL &&
(*calld->recv_message)->length > chand->max_recv_size) {
if (*calld->recv_message != NULL && chand->max_recv_size >= 0 &&
(*calld->recv_message)->length > (size_t)chand->max_recv_size) {
char* message_string;
gpr_asprintf(
&message_string, "Received message larger than max (%u vs. %lu)",
(*calld->recv_message)->length, (unsigned long)chand->max_recv_size);
gpr_asprintf(&message_string,
"Received message larger than max (%u vs. %d)",
(*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_close_with_message(
@ -88,11 +89,11 @@ static void start_transport_stream_op(grpc_exec_ctx* exec_ctx,
call_data* calld = elem->call_data;
channel_data* chand = elem->channel_data;
// Check max send message size.
if (op->send_message != NULL &&
op->send_message->length > chand->max_send_size) {
if (op->send_message != NULL && chand->max_send_size >= 0 &&
op->send_message->length > (size_t)chand->max_send_size) {
char* message_string;
gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %lu)",
op->send_message->length, (unsigned long)chand->max_send_size);
gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %d)",
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_close_with_message(
@ -130,19 +131,22 @@ static void init_channel_elem(grpc_exec_ctx* exec_ctx,
GPR_ASSERT(!args->is_last);
channel_data* chand = elem->channel_data;
memset(chand, 0, sizeof(*chand));
chand->max_send_size = DEFAULT_MAX_MESSAGE_LENGTH;
chand->max_recv_size = DEFAULT_MAX_MESSAGE_LENGTH;
const grpc_integer_options options = {DEFAULT_MAX_MESSAGE_LENGTH, 0, INT_MAX};
chand->max_send_size = DEFAULT_MAX_SEND_MESSAGE_LENGTH;
chand->max_recv_size = DEFAULT_MAX_RECV_MESSAGE_LENGTH;
for (size_t i = 0; i < args->channel_args->num_args; ++i) {
if (strcmp(args->channel_args->args[i].key,
GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) {
chand->max_send_size = (size_t)grpc_channel_arg_get_integer(
&args->channel_args->args[i], options);
const grpc_integer_options options = {DEFAULT_MAX_SEND_MESSAGE_LENGTH, 0,
INT_MAX};
chand->max_send_size =
grpc_channel_arg_get_integer(&args->channel_args->args[i], options);
}
if (strcmp(args->channel_args->args[i].key,
GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) {
chand->max_recv_size = (size_t)grpc_channel_arg_get_integer(
&args->channel_args->args[i], options);
const grpc_integer_options options = {DEFAULT_MAX_RECV_MESSAGE_LENGTH, 0,
INT_MAX};
chand->max_recv_size =
grpc_channel_arg_get_integer(&args->channel_args->args[i], options);
}
}
}

@ -32,7 +32,7 @@
*/
// Generated by the gRPC protobuf plugin.
// Generated by tools/codegen/extensions/gen_reflection_proto.sh
// If you make any local change, they will be lost.
// source: reflection.proto

@ -32,7 +32,7 @@
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// Generated by tools/codegen/extensions/gen_reflection_proto.sh
// source: reflection.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION

@ -136,6 +136,7 @@ cdef extern from "grpc/grpc.h":
const char *GRPC_ARG_ENABLE_CENSUS
const char *GRPC_ARG_MAX_CONCURRENT_STREAMS
const char *GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
const char *GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
const char *GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
const char *GRPC_ARG_DEFAULT_AUTHORITY
const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING

@ -39,7 +39,8 @@ class ConnectivityState:
class ChannelArgKey:
enable_census = GRPC_ARG_ENABLE_CENSUS
max_concurrent_streams = GRPC_ARG_MAX_CONCURRENT_STREAMS
max_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
max_receive_message_length = GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH
max_send_message_length = GRPC_ARG_MAX_SEND_MESSAGE_LENGTH
http2_initial_sequence_number = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER
default_authority = GRPC_ARG_DEFAULT_AUTHORITY
primary_user_agent_string = GRPC_ARG_PRIMARY_USER_AGENT_STRING

@ -29,20 +29,39 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
cd $(dirname $0)/../../..
PROTO_DIR="src/proto/grpc/reflection/v1alpha"
PROTO_FILE="reflection"
HEADER_DIR="include/grpc++/ext"
SRC_DIR="src/cpp/ext"
INCLUDE_DIR="grpc++/ext"
TMP_DIR="tmp"
GRPC_PLUGIN="bins/opt/grpc_cpp_plugin"
PROTOC="bins/opt/protobuf/protoc"
set -e
if hash grpc_cpp_plugin 2>/dev/null; then
GRPC_PLUGIN=$(which grpc_cpp_plugin)
else
if [ -f bins/opt/grpc_cpp_plugin ]; then
GRPC_PLUGIN="bins/opt/grpc_cpp_plugin"
else
echo "gRPC protoc plugin not found"
exit 1
fi
fi
TMP_DIR=${TMP_DIR}_${PROTO_FILE}
if hash protoc 2>/dev/null; then
PROTOC=$(which protoc)
else
if [ -f bins/opt/protobuf/protoc ]; then
PROTOC="bins/opt/protobuf/protoc"
else
echo "protoc not found"
exit 1
fi
fi
cd $(dirname $0)/../../..
TMP_DIR=${TMP_DIR}_${PROTO_FILE}
[ ! -d $HEADER_DIR ] && mkdir -p $HEADER_DIR || :
[ ! -d $SRC_DIR ] && mkdir -p $SRC_DIR || :
@ -56,6 +75,9 @@ sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g"
sed -i "s/\"${PROTO_FILE}.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc
sed -i "s/\"${PROTO_FILE}.grpc.pb.h\"/<${INCLUDE_DIR/\//\\\/}\/${PROTO_FILE}.grpc.pb.h>/g" ${TMP_DIR}/${PROTO_FILE}.grpc.pb.cc
sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_reflection_proto.sh/g" ${TMP_DIR}/*.pb.h
sed -i "1s/.*/\/\/ Generated by tools\/codegen\/extensions\/gen_reflection_proto.sh/g" ${TMP_DIR}/*.pb.cc
/bin/cp LICENSE ${TMP_DIR}/TMP_LICENSE
sed -i -e "s/./ &/" -e "s/.*/ \*&/" ${TMP_DIR}/TMP_LICENSE
sed -i -r "\$a\ *\n *\/\n\n" ${TMP_DIR}/TMP_LICENSE

Loading…
Cancel
Save