diff options
Diffstat (limited to 'src/cpp/server/server_builder.cc')
-rw-r--r-- | src/cpp/server/server_builder.cc | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index e28ba5af11..eab57b4ac3 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -140,6 +140,35 @@ ServerBuilder& ServerBuilder::AddListeningPort( } std::unique_ptr<Server> ServerBuilder::BuildAndStart() { + ChannelArguments args; + for (auto option = options_.begin(); option != options_.end(); ++option) { + (*option)->UpdateArguments(&args); + (*option)->UpdatePlugins(&plugins_); + } + + for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { + (*plugin)->UpdateChannelArguments(&args); + } + + if (max_receive_message_size_ >= 0) { + args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_); + } + + 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, + enabled_compression_algorithms_bitset_); + if (maybe_default_compression_level_.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL, + maybe_default_compression_level_.level); + } + if (maybe_default_compression_algorithm_.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, + maybe_default_compression_algorithm_.algorithm); + } + // == Determine if the server has any syncrhonous methods == bool has_sync_methods = false; for (auto it = services_.begin(); it != services_.end(); ++it) { @@ -184,36 +213,6 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { } } - // == Channel args == - ChannelArguments args; - for (auto option = options_.begin(); option != options_.end(); ++option) { - (*option)->UpdateArguments(&args); - (*option)->UpdatePlugins(&plugins_); - } - - for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { - (*plugin)->UpdateChannelArguments(&args); - } - - if (max_receive_message_size_ >= 0) { - args.SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, max_receive_message_size_); - } - - 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, - enabled_compression_algorithms_bitset_); - if (maybe_default_compression_level_.is_set) { - args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL, - maybe_default_compression_level_.level); - } - if (maybe_default_compression_algorithm_.is_set) { - args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, - maybe_default_compression_algorithm_.algorithm); - } - // TODO (sreek) Make the number of pollers configurable std::unique_ptr<Server> server( new Server(sync_server_cqs, max_receive_message_size_, &args, |