Skip to content

Commit

Permalink
CR1
Browse files Browse the repository at this point in the history
  • Loading branch information
GehaFearless committed Aug 29, 2022
1 parent c357a81 commit 601e123
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 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
9 changes: 7 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,11 @@
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 +70,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
9 changes: 9 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,11 @@ 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
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 601e123

Please sign in to comment.