aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjiangxiaoming <jiangxiaoming@outlook.com>2020-06-22 09:18:04 +0800
committerFlorin Coras <florin.coras@gmail.com>2020-07-13 21:41:32 +0000
commit3999a4bdb76ae45711f494566d14cb0c7665c051 (patch)
tree4c60b4362683bf18abf80c03ab560e2809f2114a
parentb495e9fd6d75eee7e6193a362d2271e270d39ccf (diff)
hsa: set connected mode for echo_server app in udp mode.
Type: fix Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: I85a53ee049a9af371d929364400fe166cf71d53f
-rw-r--r--src/plugins/hs_apps/echo_server.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/plugins/hs_apps/echo_server.c b/src/plugins/hs_apps/echo_server.c
index c8335e3d813..4e758619a6a 100644
--- a/src/plugins/hs_apps/echo_server.c
+++ b/src/plugins/hs_apps/echo_server.c
@@ -400,14 +400,27 @@ echo_server_detach (void)
static int
echo_server_listen ()
{
- int rv;
+ i32 rv;
echo_server_main_t *esm = &echo_server_main;
- vnet_listen_args_t _a, *a = &_a;
- clib_memset (a, 0, sizeof (*a));
- a->app_index = esm->app_index;
- a->uri = esm->server_uri;
- rv = vnet_bind_uri (a);
- esm->listener_handle = a->handle;
+ vnet_listen_args_t _args = {
+ .app_index = esm->app_index,
+ .sep_ext = {
+ .app_wrk_index = 0,
+ }
+ }, *args = &_args;
+
+ if ((rv = parse_uri (esm->server_uri, &args->sep_ext)))
+ {
+ return -1;
+ }
+
+ if (args->sep_ext.transport_proto == TRANSPORT_PROTO_UDP)
+ {
+ args->sep_ext.transport_flags = TRANSPORT_CFG_F_CONNECTED;
+ }
+
+ rv = vnet_listen (args);
+ esm->listener_handle = args->handle;
return rv;
}