diff --git a/frameworks/proxy/module_loader/src/mmi_client.cpp b/frameworks/proxy/module_loader/src/mmi_client.cpp index 1fb04bc0d0cb7beed44a518835d96a6d1c75c3dc..94d571b1ec46fccbf3e93653f770109a456c1dcb 100644 --- a/frameworks/proxy/module_loader/src/mmi_client.cpp +++ b/frameworks/proxy/module_loader/src/mmi_client.cpp @@ -113,27 +113,24 @@ bool MMIClient::StartEventRunner() eventHandler_ = std::make_shared(runner); eventHandler_->PostTask([this] { this->SetScheduler(); }); MMI_HILOGI("Create event handler, thread name:%{public}s", runner->GetRunnerThreadName().c_str()); - if (!eventHandler_->PostTask([this] { return this->OnReconnect(); }, CLIENT_RECONNECT_COOLING_TIME)) { - MMI_HILOGE("Send reconnect event failed"); + } + + auto runner = eventHandler_->GetEventRunner(); + MMI_HILOGI("reuse current event handler, thread name:%{public}s", + runner->GetRunnerThreadName().c_str()); + if (isConnected_ && fd_ >= 0) { + if (isListening_) { + MMI_HILOGI("File fd is in listening"); + return true; + } + if (!AddFdListener(fd_)) { + MMI_HILOGE("Add fd listener failed"); return false; } } else { - if (!USE_FILE_DESCRIPTION) { - MMI_HILOGE("const.sys.param_file_description_monitor is false, can not reuse fd thread"); - return true; - } - if (isConnected_ && fd_ >= 0 && isListening_) { - MMI_HILOGI("File fd is in listening"); - return true; - } else { - if (!AddFdListener(fd_)) { - MMI_HILOGE("Add fd listener failed"); - return false; - } else { - auto runner = eventHandler_->GetEventRunner(); - MMI_HILOGI("Reuse current event handler, thread name:%{public}s", - runner->GetRunnerThreadName().c_str()); - } + if (!eventHandler_->PostTask([this] { return this->OnReconnect(); }, CLIENT_RECONNECT_COOLING_TIME)) { + MMI_HILOGE("Send reconnect event failed"); + return false; } } return true;