From 332a0c90a97870cffd48ec1cb1c5b8918819a339 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 12 Apr 2024 12:38:30 +0900 Subject: [PATCH] Revert 'eed76e3a1c1ded0075bd5e879ef7494c65b91d93' This patch reverts 'eed76e3a1c1ded0075bd5e879ef7494c65b91d93' commit related to aul proc implmentation. Change-Id: Ifb865e741bdb41079a5980db5a4e82d3f974d0ab Signed-off-by: Hwankyu Jhun --- src/aul/aul_proc.cc | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/aul/aul_proc.cc b/src/aul/aul_proc.cc index b94efa4..a8d24ee 100644 --- a/src/aul/aul_proc.cc +++ b/src/aul/aul_proc.cc @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -45,10 +44,7 @@ namespace { class ProcContext { public: ProcContext() {} - ~ProcContext() { - if (source_ != 0) - g_source_remove(source_); - } + ~ProcContext() {} void SetName(std::string name) { std::lock_guard lock(mutex_); @@ -73,7 +69,6 @@ class ProcContext { void SetFd(int fd) { std::lock_guard lock(mutex_); fd_.Set(fd); - source_ = g_unix_fd_add(fd, G_IO_IN, UnixFdFunc, this); } void Close() { @@ -87,41 +82,10 @@ class ProcContext { } private: - void Reset() { - std::lock_guard lock(mutex_); - name_ = ""; - fd_.Close(); - extra_ = tizen_base::Bundle(); - source_ = 0; - } - - static gboolean UnixFdFunc(gint fd, GIOCondition condition, - gpointer user_data) { - auto* proc_context = static_cast(user_data); - - if (condition & G_IO_IN) { - int ret = aul_sock_recv_result_with_fd(fd); - if (ret != 0) { - _E("Failed to receive result. fd(%d)", fd); - proc_context->Reset(); - return G_SOURCE_REMOVE; - } - _D("Result(%d) received", ret); - } else if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { - _E("Socket was disconnected. fd(%d)", fd); - proc_context->Reset(); - return G_SOURCE_REMOVE; - } - - return G_SOURCE_CONTINUE; - } - - private: FileDescriptor fd_; std::string name_; tizen_base::Bundle extra_; mutable std::mutex mutex_; - guint source_ = 0; }; int ReadFromPath(const std::string& path, char* buf, size_t buf_size) { @@ -247,6 +211,13 @@ extern "C" API int aul_proc_register(const char* name, bundle* extra) { return ret; } + int res = aul_sock_recv_result_with_fd(ret); + if (res != 0) { + _E("Failed to receive the result. fd(%d)", ret); + close(ret); + return AUL_R_ERROR; + } + context.SetFd(ret); context.SetName(name); if (extra) -- 2.7.4