mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Add empty logger to DHT bootstrap daemons.
These should register a proper logging callback so the messages don't go devnull, but this at least ensures a logger is available.
This commit is contained in:
parent
be797d4b03
commit
4f6ab0708c
|
@ -30,8 +30,9 @@
|
|||
#endif
|
||||
|
||||
#include "../toxcore/DHT.h"
|
||||
#include "../toxcore/friend_requests.h"
|
||||
#include "../toxcore/LAN_discovery.h"
|
||||
#include "../toxcore/friend_requests.h"
|
||||
#include "../toxcore/logger.h"
|
||||
#include "../toxcore/tox.h"
|
||||
#include "../toxcore/util.h"
|
||||
|
||||
|
@ -115,7 +116,8 @@ int main(int argc, char *argv[])
|
|||
IP ip;
|
||||
ip_init(&ip, ipv6enabled);
|
||||
|
||||
DHT *dht = new_DHT(nullptr, new_networking(nullptr, ip, PORT), true);
|
||||
Logger *logger = logger_new();
|
||||
DHT *dht = new_DHT(logger, new_networking(nullptr, ip, PORT), true);
|
||||
Onion *onion = new_onion(dht);
|
||||
Onion_Announce *onion_a = new_onion_announce(dht);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "../../../toxcore/tox.h"
|
||||
#include "../../../toxcore/LAN_discovery.h"
|
||||
#include "../../../toxcore/TCP_server.h"
|
||||
#include "../../../toxcore/logger.h"
|
||||
#include "../../../toxcore/onion_announce.h"
|
||||
#include "../../../toxcore/util.h"
|
||||
|
||||
|
@ -245,10 +246,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
DHT *dht = new_DHT(nullptr, net, true);
|
||||
Logger *logger = logger_new();
|
||||
DHT *dht = new_DHT(logger, net, true);
|
||||
|
||||
if (dht == nullptr) {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n");
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -257,6 +260,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (!(onion && onion_a)) {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox Onion. Exiting.\n");
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -265,6 +269,7 @@ int main(int argc, char *argv[])
|
|||
log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n");
|
||||
} else {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't set MOTD: %s. Exiting.\n", motd);
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -275,6 +280,7 @@ int main(int argc, char *argv[])
|
|||
log_write(LOG_LEVEL_INFO, "Keys are managed successfully.\n");
|
||||
} else {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't read/write: %s. Exiting.\n", keys_file_path);
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -285,6 +291,7 @@ int main(int argc, char *argv[])
|
|||
if (enable_tcp_relay) {
|
||||
if (tcp_relay_port_count == 0) {
|
||||
log_write(LOG_LEVEL_ERROR, "No TCP relay ports read. Exiting.\n");
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -297,6 +304,7 @@ int main(int argc, char *argv[])
|
|||
log_write(LOG_LEVEL_INFO, "Initialized Tox TCP server successfully.\n");
|
||||
} else {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox TCP server. Exiting.\n");
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -305,6 +313,7 @@ int main(int argc, char *argv[])
|
|||
log_write(LOG_LEVEL_INFO, "List of bootstrap nodes read successfully.\n");
|
||||
} else {
|
||||
log_write(LOG_LEVEL_ERROR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path);
|
||||
logger_kill(logger);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user