Modify to listen only G_IO_IN event 52/276352/1
authorIlho Kim <ilho159.kim@samsung.com>
Wed, 15 Jun 2022 01:24:21 +0000 (10:24 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Wed, 15 Jun 2022 06:09:51 +0000 (15:09 +0900)
Change-Id: Iab1098f361392c2224ce0ab244eea0ad151a8212
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
(cherry picked from commit 1f925c555f909249d3551c1e64b60adf9e2738de)

src/server/runner.cc

index e3802156dd182fff33ae66e476b142aa0ca31821..1cfbbb36b10512f1d4adeef2936fdbf3378e5ae5 100644 (file)
@@ -50,8 +50,7 @@ Runner::Runner(unsigned int thread_num) {
   CynaraChecker::GetInst().Init();
   server_ = std::make_unique<pkgmgr_common::socket::ServerSocket>(SOCK_PATH);
   thread_pool_ = std::make_unique<WorkerThread>(thread_num_);
-  auto condition = static_cast<GIOCondition>(
-      G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL);
+  auto condition = static_cast<GIOCondition>(G_IO_IN);
   sid_ = g_unix_fd_add(server_->GetFd(), condition, OnReceiveRequest, this);
   pkgmgr_common::SystemLocale::GetInst().RegisterEvent(this);
   thread_pool_->SetLocale(pkgmgr_common::SystemLocale::GetInst().Get());
@@ -65,13 +64,6 @@ Runner::~Runner() {
 }
 
 int Runner::OnReceiveRequest(int fd, GIOCondition cond, void* user_data) {
-  if (static_cast<int>(cond) & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
-    LOG(ERROR) << "Invalid condition fd:" << fd
-        << ", condition:" << static_cast<int>(cond);
-    abort();
-    return G_SOURCE_REMOVE;
-  }
-
   auto runner = static_cast<Runner*>(user_data);
   int client_fd = runner->server_->Accept();
   if (client_fd < 0) {