}
if (source_) {
- if (g_source_is_destroyed(source_))
+ if (!g_source_is_destroyed(source_))
g_source_destroy(source_);
}
}
gboolean Server::GIOFunc(GIOChannel* source, GIOCondition cond, gpointer data) {
+ if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
+ _E("Error condition(%d)", static_cast<int>(cond));
+ return G_SOURCE_REMOVE;
+ }
+
auto* handle = static_cast<Server*>(data);
auto client = std::unique_ptr<Client>(handle->Accept());
+ if (client.get() == nullptr)
+ return G_SOURCE_CONTINUE;
+
int ret = handle->CheckPrivilege(client->GetFd());
if (ret != 0) {
_E("Request is denied");