예제 #1
0
파일: BackendManager.cpp 프로젝트: 40a/BFS
Backend* BackendManager::getActiveBackend() {
  if(currentBackend != nullptr)
    return currentBackend;
  if(list.size() > 0) {
    selectBackend(list.back());
    return currentBackend;
  }
  else
    return nullptr;
}
예제 #2
0
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);
	}
}
예제 #3
0
파일: core.cpp 프로젝트: Bombe/quassel
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);
}