Skip to content

Commit

Permalink
feat(server): disable UDP service by default
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Aug 22, 2022
1 parent dbd670e commit c357a81
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
30 changes: 17 additions & 13 deletions src/rdsn/src/runtime/nativerun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

#include <dsn/tool/nativerun.h>
#include <dsn/utility/config_api.h>

namespace dsn {
namespace tools {
Expand All @@ -59,19 +60,22 @@ void nativerun::install(service_spec &spec)
cs2.message_buffer_block_size = 1024 * 64;
spec.network_default_server_cfs[cs2] = cs2;
}
{
network_client_config cs;
cs.factory_name = "dsn::tools::asio_udp_provider";
cs.message_buffer_block_size = 1024 * 64;
spec.network_default_client_cfs[RPC_CHANNEL_UDP] = cs;
}
{
network_server_config cs2;
cs2.port = 0;
cs2.channel = RPC_CHANNEL_UDP;
cs2.factory_name = "dsn::tools::asio_udp_provider";
cs2.message_buffer_block_size = 1024 * 64;
spec.network_default_server_cfs[cs2] = cs2;
if (dsn_config_get_value_bool(
"network", "enable_udp", false, "whether to enable udp rpc engine")) {
{
network_client_config cs;
cs.factory_name = "dsn::tools::asio_udp_provider";
cs.message_buffer_block_size = 1024 * 64;
spec.network_default_client_cfs[RPC_CHANNEL_UDP] = cs;
}
{
network_server_config cs2;
cs2.port = 0;
cs2.channel = RPC_CHANNEL_UDP;
cs2.factory_name = "dsn::tools::asio_udp_provider";
cs2.message_buffer_block_size = 1024 * 64;
spec.network_default_server_cfs[cs2] = cs2;
}
}

if (spec.logging_factory_name == "")
Expand Down
5 changes: 4 additions & 1 deletion src/rdsn/src/runtime/providers.common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ void register_common_providers()

register_std_lock_providers();

if (dsn_config_get_value_bool(
"network", "enable_udp", false, "whether to enable udp rpc engine")) {
register_component_provider<asio_udp_provider>("dsn::tools::asio_udp_provider");
}
register_component_provider<asio_network_provider>("dsn::tools::asio_network_provider");
register_component_provider<asio_udp_provider>("dsn::tools::asio_udp_provider");
register_component_provider<sim_network_provider>("dsn::tools::sim_network_provider");
register_component_provider<simple_task_queue>("dsn::tools::simple_task_queue");
register_component_provider<hpc_concurrent_task_queue>("dsn::tools::hpc_concurrent_task_queue");
Expand Down
1 change: 1 addition & 0 deletions src/rdsn/src/runtime/test/config-test-corrupt-message.ini
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ random_seed = 0
[network]
; how many network threads for network library (used by asio)
io_service_worker_count = 2
enable_udp = true

[task..default]
is_trace = true
Expand Down
1 change: 1 addition & 0 deletions src/rdsn/src/runtime/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ random_seed = 0
[network]
; how many network threads for network library (used by asio)
io_service_worker_count = 2
enable_udp = true

[task..default]
is_trace = true
Expand Down
3 changes: 1 addition & 2 deletions src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
io_service_worker_count = 4
; how many connections can be established from one ip address to a server(both replica and meta), 0 means no threshold
conn_threshold_per_ip = 0
enable_udp = false

; specification for each thread pool
[threadpool..default]
Expand Down Expand Up @@ -708,12 +709,10 @@

[task.RPC_FD_FAILURE_DETECTOR_PING]
rpc_call_header_format = NET_HDR_DSN
rpc_call_channel = RPC_CHANNEL_UDP
rpc_message_crc_required = true
;is_profile = true

[task.RPC_FD_FAILURE_DETECTOR_PING_ACK]
rpc_call_header_format = NET_HDR_DSN
rpc_call_channel = RPC_CHANNEL_UDP
rpc_message_crc_required = true
;is_profile = true

0 comments on commit c357a81

Please sign in to comment.