void svExec::Exited(int status) { #if !defined(__WIN32__) && !defined(__ANDROID__) pid = -1; exited = true; if (WIFEXITED(status)) { svLog("%s: Exited with code: %d", name.c_str(), WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { svLog("%s: Exited by signal: %s", name.c_str(), strsignal(WTERMSIG(status))); } else svError("%s: Did not exit normally"); #endif }
void svConfServer::Usage(bool version) { svLog("Suva Server v%s Protocol v%d.%d: %s", PACKAGE_VERSION, _SUVA_PROTO_VER_MAJOR, _SUVA_PROTO_VER_MINOR, _SUVA_VER_RELEASE); if (!version) CommonUsage(); throw svExConfUsageRequest(); }
void svServer::PoolClientLoad(svEventPoolClientLoad *event) { svPoolClient *client = NULL; map<string, map<string, vector<svPoolClient *> > >::iterator io; io = pool.find(event->GetOrganization()); if (io != pool.end()) { map<string, vector<svPoolClient *> >::iterator id; id = io->second.find(event->GetDevice()); if (id != io->second.end() && id->second.size()) { client = id->second.back(); id->second.pop_back(); if (!id->second.size()) io->second.erase(id); } } if (client) { for (vector<svSocket *>::iterator i = skt_client.begin(); i != skt_client.end(); i++) { if ((*i) != client->GetSocket()) continue; skt_client.erase(i); skt_set.RemoveForRead(client->GetSocket()); break; } svLog("%s: Pool client found: %s %s [%s]", name.c_str(), client->GetName().c_str(), client->GetDevice().c_str(), event->GetOrganization().c_str()); map<string, svThreadStorage *>::iterator i; i = storage.find(event->GetOrganization()); if (i != storage.end()) { svEventServer::GetInstance()->Dispatch( new svEventPoolClientUpdate( i->second, client->GetName(), event->GetDevice(), svPCS_INUSE)); } } else { svError("%s: %s: Pool client not found: %s", name.c_str(), event->GetOrganization().c_str(), event->GetDevice().c_str()); } svEventServer::GetInstance()->Dispatch( new svEventPoolClientLoad(this, event->GetSource(), client)); }
static void db_output(const char *prefix, char *message) #endif // DB_VERSION { svLog("%s: %s", prefix, message); }
void svStorageEngine::Disconnect(void) { state = svSES_OFFLINE; svLog("%s: offline", name.c_str()); }
void svStorageEngine::Connect(void) { state = svSES_ONLINE; svLog("%s: online", name.c_str()); }
void svServer::PoolClientSave(svEventPoolClientSave *event) { svPoolClient *client = event->GetClient(); svConfOrganization *org = conf->GetOrganization(client->GetOrganization()); if (!org) { svError("%s: Organization not found: %s", name.c_str(), client->GetOrganization().c_str()); delete client; return; } if (org->GetMaxPoolConnections() == 0) { svError("%s: %s: Pool connections disabled", name.c_str(), org->GetName().c_str()); delete client; return; } map<string, map<string, vector<svPoolClient *> > >::iterator io; io = pool.find(client->GetOrganization()); if (io != pool.end()) { map<string, vector<svPoolClient *> >::iterator id; id = io->second.find(client->GetDevice()); if (id != io->second.end()) { if (id->second.size() >= org->GetMaxPoolConnections()) { svError("%s: %s: Maximum pool connections reached, " "clients: %d", name.c_str(), org->GetName().c_str(), skt_client.size()); delete client; return; } } } svSocket *skt = client->GetSocket(); skt->SetDevice(client->GetDevice()); skt->SetOrganization(client->GetOrganization()); skt->SetConnected(); skt_client.push_back(skt); skt_set.SelectForRead(skt); pool[org->GetName()][client->GetDevice()].push_back(client); svLog("%s: Saved pool client: %s %s [%s] (%d)", name.c_str(), client->GetName().c_str(), client->GetDevice().c_str(), client->GetOrganization().c_str(), pool[org->GetName()][client->GetDevice()].size()); map<string, svThreadStorage *>::iterator i; i = storage.find(client->GetOrganization()); if (i != storage.end()) { svEventServer::GetInstance()->Dispatch( new svEventPoolClientUpdate( i->second, client->GetName(), client->GetDevice(), svPCS_IDLE)); } for (io = pool.begin(); io != pool.end(); io++) { map<string, vector<svPoolClient *> >::iterator id; for (id = io->second.begin(); id != io->second.end(); id++) { vector<svPoolClient *>::iterator pci; for (pci = id->second.begin(); pci != id->second.end(); pci++) { svDebug("%s: Pool client: %s %s [%s]", name.c_str(), (*pci)->GetName().c_str(), (*pci)->GetDevice().c_str(), (*pci)->GetOrganization().c_str()); } } } }