Esempio n. 1
0
bool Client::start(bool _server)
{
    if (lc) {
        lc->deleteLater();
    }
    lc = new QSS::Controller(!_server, this);
    connect (lc, &QSS::Controller::info, this, &Client::logHandler);
    if (profile.debug) {
        connect(lc, &QSS::Controller::debug, this, &Client::logHandler);
    }
    lc->setup(profile);
    return lc->start() && cipherTest();
}
Esempio n. 2
0
bool Client::start(bool _server)
{
    if (profile.debug) {
        if (!cipherTest()) {
            QSS::Common::qOut << "Cipher test failed" << endl;
            return false;
        }
        if (!headerTest()) {
            QSS::Common::qOut << "Header test failed" << endl;
            return false;
        }
    }

    if (lc) {
        lc->deleteLater();
    }
    lc = new QSS::Controller(!_server, autoBan, this);
    connect (lc, &QSS::Controller::info, this, &Client::logHandler);
    if (profile.debug) {
        connect(lc, &QSS::Controller::debug, this, &Client::logHandler);
    }
    lc->setup(profile);

    if (!_server) {
        QSS::Address server(profile.server, profile.server_port);
        QSS::AddressTester *tester =
                new QSS::AddressTester(server.getFirstIP(),
                                       server.getPort());
        connect(tester, &QSS::AddressTester::connectivityTestFinished,
                this, &Client::onConnectivityResultArrived);
        tester->startConnectivityTest(profile.method,
                                      profile.password,
                                      profile.auth);
    }

    return lc->start();
}