Skip to content

Commit

Permalink
CR1
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Aug 31, 2022
1 parent c357a81 commit eba217c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..."
Expand Down
7 changes: 4 additions & 3 deletions src/rdsn/src/runtime/nativerun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
*/

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

namespace dsn {
namespace tools {

DSN_DECLARE_bool(enable_udp);

void nativerun::install(service_spec &spec)
{
if (spec.env_factory_name == "")
Expand All @@ -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";
Expand Down
6 changes: 4 additions & 2 deletions src/rdsn/src/runtime/providers.common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "runtime/rpc/asio_net_provider.h"
#include <dsn/tool/providers.common.h>
#include <dsn/utility/flags.h>
#include "utils/lockp.std.h"
#include "runtime/task/simple_task_queue.h"
#include "runtime/task/hpc_task_queue.h"
Expand All @@ -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<std_lock_provider>("dsn::tools::std_lock_provider");
Expand All @@ -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<asio_udp_provider>("dsn::tools::asio_udp_provider");
}
register_component_provider<asio_network_provider>("dsn::tools::asio_network_provider");
Expand Down
10 changes: 10 additions & 0 deletions src/rdsn/src/runtime/task/task_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@
#include <dsn/tool-api/task_spec.h>
#include <dsn/tool-api/command_manager.h>
#include <dsn/tool-api/threadpool_spec.h>
#include <dsn/utility/flags.h>
#include <dsn/utility/smart_pointers.h>

namespace dsn {
namespace tools {
DSN_DECLARE_bool(enable_udp);
}

constexpr int TASK_SPEC_STORE_CAPACITY = 512;

Expand Down Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/rdsn/src/runtime/test/config-test-corrupt-message.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/rdsn/src/runtime/test/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/server/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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

0 comments on commit eba217c

Please sign in to comment.