more debug, free mem, lib update

This commit is contained in:
Deniod
2023-12-13 17:28:52 +01:00
parent 7dd665131e
commit 7863d6ffb2
6 changed files with 172 additions and 152 deletions

View File

@@ -105,15 +105,15 @@ void ConnectionLoader::ShowProgress()
DEBUG("server=" << config->server << " connection=" << connection << " me=" << me);
isSyncing = new QAtomicInteger<bool>();
isSyncing->store(true);
isSyncing->storeRelaxed(true);
DEBUG("isSyncing");
// Do a sync after import
syncTimer = new QTimer(main);
DEBUG("Beginning sync after import wif");
connection->doRPC("sync", "", [=](auto) {
DEBUG("finished syncing");
isSyncing->store(false);
qDebug()<< "finished syncing";
isSyncing->storeRelaxed(false);
// Cancel the timer
syncTimer->deleteLater();
// When sync is done, set the connection
@@ -125,7 +125,7 @@ void ConnectionLoader::ShowProgress()
// While it is syncing, we'll show the status updates while it is alive.
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
DEBUG("Check the sync status");
if (isSyncing != nullptr && isSyncing->load()) {
if (isSyncing != nullptr && isSyncing->loadRelaxed()) {
DEBUG("Get the sync status");
try {
connection->doRPC("syncstatus", "", [=](json reply) {
@@ -220,7 +220,7 @@ void ConnectionLoader::doAutoConnect()
auto connection = makeConnection(config);
auto me = this;
qDebug() << __func__ << ": server=" << config->server
<< " connection=" << connection << " me=" << me << endl;
<< " connection=" << connection << " me=" << me << Qt::endl;
// After the lib is initialized, try to do get info
connection->doRPC("info", "", [=](auto reply) {
@@ -229,15 +229,15 @@ void ConnectionLoader::doAutoConnect()
connection->setInfo(reply);
DEBUG("getting Connection reply");
isSyncing = new QAtomicInteger<bool>();
isSyncing->store(true);
isSyncing->storeRelaxed(true);
DEBUG("isSyncing");
// Do a sync at startup
syncTimer = new QTimer(main);
DEBUG("Beginning sync");
connection->doRPC("sync", "", [=](auto) {
DEBUG("finished syncing");
isSyncing->store(false);
qDebug()<<"finished syncing startup";
isSyncing->storeRelaxed(false);
// Cancel the timer
syncTimer->deleteLater();
// When sync is done, set the connection
@@ -252,9 +252,9 @@ void ConnectionLoader::doAutoConnect()
// auto connection = makeConnection(config);
// DEBUG("changed server to " << config->server);
connection->doRPC("sync", "", [=](auto) mutable {
DEBUG("sync success with server=" << config->server);
qDebug()<<"sync success with server=" << config->server;
failed = false;
isSyncing->store(false);
isSyncing->storeRelaxed(false);
// Cancel the timer
syncTimer->deleteLater();
// When sync is done, set the connection
@@ -268,7 +268,7 @@ void ConnectionLoader::doAutoConnect()
// While it is syncing, we'll show the status updates while it is alive.
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
DEBUG("Check the sync status");
if (isSyncing != nullptr && isSyncing->load()) {
if (isSyncing != nullptr && isSyncing->loadRelaxed()) {
DEBUG("Getting the sync status");
try {
connection->doRPC("syncstatus", "", [=](json reply) {