From: Hosang Kim Date: Mon, 8 Apr 2024 04:57:53 +0000 (+0900) Subject: bootstrap: add feature to change port number(50051-50060). X-Git-Tag: accepted/tizen/unified/20240424.063514~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=296f56df3c00478e51c82df75d17524e4d240169;p=platform%2Fcore%2Fuifw%2Faurum.git bootstrap: add feature to change port number(50051-50060). ex) tv app_launcher -s org.tizen.aurum-bootstrap port 50051 fhub app_launcher -s org.tizen.aurum-bootstrap port 50052 Change-Id: I4b4fef76d8815192a06a54fcb1dc0307515797a4 --- diff --git a/org.tizen.aurum-bootstrap/src/BootstrapServer.cc b/org.tizen.aurum-bootstrap/src/BootstrapServer.cc index 7ae8188..5acc8ee 100644 --- a/org.tizen.aurum-bootstrap/src/BootstrapServer.cc +++ b/org.tizen.aurum-bootstrap/src/BootstrapServer.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include "AurumServiceImpl.h" #include "config.h" @@ -30,6 +31,7 @@ typedef struct _ServiceContext { GThread *thread; std::unique_ptr server; bool forceTouchEnabled; + int port; } ServiceContext; static void _vconf_force_enable_touch_set(void *data, bool enable) @@ -52,7 +54,8 @@ static gpointer _grpc_thread_func(gpointer data) { ServiceContext *ctx = (ServiceContext *)data; - std::string binding("0.0.0.0:50051"); + std::string binding("0.0.0.0:"); + binding.append(std::to_string(ctx->port)); aurumServiceImpl service; ServerBuilder builder; char *value; @@ -123,6 +126,21 @@ int main(int argc, char **argv) int result = -1; + bundle *b = bundle_import_from_argv(argc, argv); + char *port = NULL; + bundle_get_str (b, "port", &port); + if (!port) { + ctx.port = 50051; + } + else { + ctx.port = atoi(port); + if (ctx.port < 50051 || ctx.port > 50061) { + LOGE("Port number is invalid!"); + ctx.port = 50051; + } + } + bundle_free(b); + try { result = service_app_main(argc, argv, &event_callback, &ctx); } catch (const std::exception& e) {