You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2022/09/06 03:09:13 UTC

[GitHub] [incubator-pegasus] acelyc111 commented on a diff in pull request #1132: feat(server): disable UDP service by config

acelyc111 commented on code in PR #1132:
URL: https://github.com/apache/incubator-pegasus/pull/1132#discussion_r963214249


##########
src/rdsn/src/runtime/task/task_spec.cpp:
##########
@@ -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");

Review Comment:
   Better to clarify what config it is, that is `[network].enable_udp`



##########
src/rdsn/src/runtime/nativerun.cpp:
##########
@@ -59,19 +62,21 @@ 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 (FLAGS_enable_udp) {
+        {
+            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;

Review Comment:
   Now that they are in different scope, it's not needed to use different name, `cs2` is not a very good name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org