Modify to listen only G_IO_IN event 29/276329/2
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 05:53:12 +0000 (14:53 +0900)
Change-Id: Iab1098f361392c2224ce0ab244eea0ad151a8212
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/server/runner.cc

index 03b5be4..4e4589b 100644 (file)
@@ -52,8 +52,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());
@@ -73,13 +72,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) {