diff --git a/run.sh b/run.sh index 06606e6785..7133829e88 100755 --- a/run.sh +++ b/run.sh @@ -283,7 +283,7 @@ function run_build() echo "#define PEGASUS_GIT_COMMIT \"$PEGASUS_GIT_COMMIT\"" >>$GIT_COMMIT_FILE # rebuild link - rm -f ${ROOT}/src/builder + rm -rf ${ROOT}/src/builder ln -s ${BUILD_DIR} ${ROOT}/src/builder echo "[$(date)] Building Pegasus ..." diff --git a/src/rdsn/src/runtime/nativerun.cpp b/src/rdsn/src/runtime/nativerun.cpp index ed60f691c8..e548f792f6 100644 --- a/src/rdsn/src/runtime/nativerun.cpp +++ b/src/rdsn/src/runtime/nativerun.cpp @@ -34,11 +34,13 @@ */ #include -#include +#include namespace dsn { namespace tools { +DSN_DECLARE_bool(enable_udp); + void nativerun::install(service_spec &spec) { if (spec.env_factory_name == "") @@ -60,8 +62,7 @@ void nativerun::install(service_spec &spec) 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")) { + if (FLAGS_enable_udp) { { network_client_config cs; cs.factory_name = "dsn::tools::asio_udp_provider"; diff --git a/src/rdsn/src/runtime/providers.common.cpp b/src/rdsn/src/runtime/providers.common.cpp index 79a9c72046..d60ca691dd 100644 --- a/src/rdsn/src/runtime/providers.common.cpp +++ b/src/rdsn/src/runtime/providers.common.cpp @@ -35,6 +35,7 @@ #include "runtime/rpc/asio_net_provider.h" #include +#include #include "utils/lockp.std.h" #include "runtime/task/simple_task_queue.h" #include "runtime/task/hpc_task_queue.h" @@ -47,6 +48,8 @@ namespace dsn { namespace tools { +DSN_DEFINE_bool("network", enable_udp, true, "whether to enable udp rpc engine"); + void register_std_lock_providers() { lock_provider::register_component("dsn::tools::std_lock_provider"); @@ -64,8 +67,7 @@ void register_common_providers() register_std_lock_providers(); - if (dsn_config_get_value_bool( - "network", "enable_udp", false, "whether to enable udp rpc engine")) { + if (FLAGS_enable_udp) { register_component_provider("dsn::tools::asio_udp_provider"); } register_component_provider("dsn::tools::asio_network_provider"); diff --git a/src/rdsn/src/runtime/task/task_spec.cpp b/src/rdsn/src/runtime/task/task_spec.cpp index 6b469ec865..de561f2973 100644 --- a/src/rdsn/src/runtime/task/task_spec.cpp +++ b/src/rdsn/src/runtime/task/task_spec.cpp @@ -39,9 +39,13 @@ #include #include #include +#include #include namespace dsn { +namespace tools { +DSN_DECLARE_bool(enable_udp); +} constexpr int TASK_SPEC_STORE_CAPACITY = 512; @@ -232,6 +236,12 @@ bool task_spec::init() return false; } } + + if (spec->rpc_call_channel == RPC_CHANNEL_UDP && !dsn::tools::FLAGS_enable_udp) { + derror("task rpc_call_channel RPC_CHANNEL_UCP need udp service, set network " + "configuration enable_udp true"); + return false; + } } ::dsn::command_manager::instance().register_command( diff --git a/src/rdsn/src/runtime/test/config-test-corrupt-message.ini b/src/rdsn/src/runtime/test/config-test-corrupt-message.ini index 346ebae051..92efa64dda 100644 --- a/src/rdsn/src/runtime/test/config-test-corrupt-message.ini +++ b/src/rdsn/src/runtime/test/config-test-corrupt-message.ini @@ -75,7 +75,6 @@ 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 diff --git a/src/rdsn/src/runtime/test/config-test.ini b/src/rdsn/src/runtime/test/config-test.ini index d53cf1d551..08ee8009e7 100644 --- a/src/rdsn/src/runtime/test/config-test.ini +++ b/src/rdsn/src/runtime/test/config-test.ini @@ -91,7 +91,6 @@ 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 diff --git a/src/server/config.ini b/src/server/config.ini index 39c15af566..206fc0762b 100644 --- a/src/server/config.ini +++ b/src/server/config.ini @@ -94,7 +94,6 @@ 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] @@ -709,10 +708,12 @@ [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