Revert "Merge branch 'dev'"

This reverts commit 4a7dd7f959, reversing
changes made to a89a0cc1c6.
This commit is contained in:
onryo
2024-01-06 16:27:48 +01:00
parent 4a7dd7f959
commit 3c2414028b
127 changed files with 1747 additions and 770 deletions

View File

@@ -1,10 +1,9 @@
// Copyright 2019-2024 The Hush developers
// Copyright 2019-2023 The Hush developers
// Released under the GPLv3
#include "mainwindow.h"
#include "settings.h"
#include "camount.h"
#include "../lib/silentdragonlitelib.h"
#include <QUrlQuery>
Settings* Settings::instance = nullptr;
@@ -37,14 +36,9 @@ Config Settings::getSettings() {
if (server.trimmed().isEmpty()) {
server = Settings::getRandomServer();
QString response = "";
// make sure existing server in conf is alive, otherwise choose random one
try {
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
response = litelib_process_response(resp);
} catch (const std::exception& e) {
qDebug() << __func__ << ": caught an exception, ignoring: " << e.what();
}
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
QString response = litelib_process_response(resp);
if (response.toUpper().trimmed() != "OK") {
qDebug() << "Lite server in conf " << server << " is down, getting a random one";
@@ -316,14 +310,14 @@ QString Settings::getRandomServer() {
// We try every server,in order, starting from a random place in the list
while (tries < servers.size() ) {
qDebug() << "Checking if lite server " << server << " is a alive, try=" << tries;
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
QString response = "";
try {
char* resp = litelib_initialize_existing(false, server.toStdString().c_str());
response = litelib_process_response(resp);
} catch (const std::exception& e) {
qDebug() << __func__ << ": caught an exception, ignoring: " << e.what();
qDebug() << __func__ << ": litelib_process_response threw an exception, ignoring: " << e.what();
}
// if we see a valid connection, return this server