Backend* BackendManager::getActiveBackend() { if(currentBackend != nullptr) return currentBackend; if(list.size() > 0) { selectBackend(list.back()); return currentBackend; } else return nullptr; }
void HttpDirector::schedule(HttpRequest* r) { r->responseHeaders.push_back("X-Director-Cluster", name_); r->setCustomData<HttpDirectorNotes>(this); auto notes = r->customData<HttpDirectorNotes>(this); // try delivering request directly if (HttpBackend* backend = selectBackend(r)) { notes->backend = backend; ++backend->active_; backend->process(r); } else { enqueue(r); } }
void Core::init() { CoreSettings cs; // legacy QVariantMap dbsettings = cs.storageSettings().toMap(); _configured = initStorage(dbsettings.value("Backend").toString(), dbsettings.value("ConnectionProperties").toMap()); if (Quassel::isOptionSet("select-backend")) { selectBackend(Quassel::optionValue("select-backend")); exit(0); } if (!_configured) { if (!_storageBackends.count()) { qWarning() << qPrintable(tr("Could not initialize any storage backend! Exiting...")); qWarning() << qPrintable(tr("Currently, Quassel supports SQLite3 and PostgreSQL. You need to build your\n" "Qt library with the sqlite or postgres plugin enabled in order for quasselcore\n" "to work.")); exit(1); // TODO make this less brutal (especially for mono client -> popup) } qWarning() << "Core is currently not configured! Please connect with a Quassel Client for basic setup."; } if (Quassel::isOptionSet("add-user")) { createUser(); exit(0); } if (Quassel::isOptionSet("change-userpass")) { changeUserPass(Quassel::optionValue("change-userpass")); exit(0); } connect(&_server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); if (!startListening()) exit(1); // TODO make this less brutal if (Quassel::isOptionSet("oidentd")) _oidentdConfigGenerator = new OidentdConfigGenerator(this); }