diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-05-20 13:13:47 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-05-20 16:15:49 +0000 |
commit | 4f6ab0708c85f3e3da7726f6caecc381c6d21370 (patch) | |
tree | 8703a7ded65f74c89964ebb751e40ff68e9dfb45 /other/bootstrap_daemon/src/tox-bootstrapd.c | |
parent | be797d4b039b40d2c876f0a71cd1e48454a74065 (diff) |
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.
Diffstat (limited to 'other/bootstrap_daemon/src/tox-bootstrapd.c')
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index 9f1a2db4..cbf81d92 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "../../../toxcore/tox.h" | 37 | #include "../../../toxcore/tox.h" |
38 | #include "../../../toxcore/LAN_discovery.h" | 38 | #include "../../../toxcore/LAN_discovery.h" |
39 | #include "../../../toxcore/TCP_server.h" | 39 | #include "../../../toxcore/TCP_server.h" |
40 | #include "../../../toxcore/logger.h" | ||
40 | #include "../../../toxcore/onion_announce.h" | 41 | #include "../../../toxcore/onion_announce.h" |
41 | #include "../../../toxcore/util.h" | 42 | #include "../../../toxcore/util.h" |
42 | 43 | ||
@@ -245,10 +246,12 @@ int main(int argc, char *argv[]) | |||
245 | } | 246 | } |
246 | } | 247 | } |
247 | 248 | ||
248 | DHT *dht = new_DHT(nullptr, net, true); | 249 | Logger *logger = logger_new(); |
250 | DHT *dht = new_DHT(logger, net, true); | ||
249 | 251 | ||
250 | if (dht == nullptr) { | 252 | if (dht == nullptr) { |
251 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n"); | 253 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox DHT instance. Exiting.\n"); |
254 | logger_kill(logger); | ||
252 | return 1; | 255 | return 1; |
253 | } | 256 | } |
254 | 257 | ||
@@ -257,6 +260,7 @@ int main(int argc, char *argv[]) | |||
257 | 260 | ||
258 | if (!(onion && onion_a)) { | 261 | if (!(onion && onion_a)) { |
259 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox Onion. Exiting.\n"); | 262 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox Onion. Exiting.\n"); |
263 | logger_kill(logger); | ||
260 | return 1; | 264 | return 1; |
261 | } | 265 | } |
262 | 266 | ||
@@ -265,6 +269,7 @@ int main(int argc, char *argv[]) | |||
265 | log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n"); | 269 | log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n"); |
266 | } else { | 270 | } else { |
267 | log_write(LOG_LEVEL_ERROR, "Couldn't set MOTD: %s. Exiting.\n", motd); | 271 | log_write(LOG_LEVEL_ERROR, "Couldn't set MOTD: %s. Exiting.\n", motd); |
272 | logger_kill(logger); | ||
268 | return 1; | 273 | return 1; |
269 | } | 274 | } |
270 | 275 | ||
@@ -275,6 +280,7 @@ int main(int argc, char *argv[]) | |||
275 | log_write(LOG_LEVEL_INFO, "Keys are managed successfully.\n"); | 280 | log_write(LOG_LEVEL_INFO, "Keys are managed successfully.\n"); |
276 | } else { | 281 | } else { |
277 | log_write(LOG_LEVEL_ERROR, "Couldn't read/write: %s. Exiting.\n", keys_file_path); | 282 | log_write(LOG_LEVEL_ERROR, "Couldn't read/write: %s. Exiting.\n", keys_file_path); |
283 | logger_kill(logger); | ||
278 | return 1; | 284 | return 1; |
279 | } | 285 | } |
280 | 286 | ||
@@ -285,6 +291,7 @@ int main(int argc, char *argv[]) | |||
285 | if (enable_tcp_relay) { | 291 | if (enable_tcp_relay) { |
286 | if (tcp_relay_port_count == 0) { | 292 | if (tcp_relay_port_count == 0) { |
287 | log_write(LOG_LEVEL_ERROR, "No TCP relay ports read. Exiting.\n"); | 293 | log_write(LOG_LEVEL_ERROR, "No TCP relay ports read. Exiting.\n"); |
294 | logger_kill(logger); | ||
288 | return 1; | 295 | return 1; |
289 | } | 296 | } |
290 | 297 | ||
@@ -297,6 +304,7 @@ int main(int argc, char *argv[]) | |||
297 | log_write(LOG_LEVEL_INFO, "Initialized Tox TCP server successfully.\n"); | 304 | log_write(LOG_LEVEL_INFO, "Initialized Tox TCP server successfully.\n"); |
298 | } else { | 305 | } else { |
299 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox TCP server. Exiting.\n"); | 306 | log_write(LOG_LEVEL_ERROR, "Couldn't initialize Tox TCP server. Exiting.\n"); |
307 | logger_kill(logger); | ||
300 | return 1; | 308 | return 1; |
301 | } | 309 | } |
302 | } | 310 | } |
@@ -305,6 +313,7 @@ int main(int argc, char *argv[]) | |||
305 | log_write(LOG_LEVEL_INFO, "List of bootstrap nodes read successfully.\n"); | 313 | log_write(LOG_LEVEL_INFO, "List of bootstrap nodes read successfully.\n"); |
306 | } else { | 314 | } else { |
307 | log_write(LOG_LEVEL_ERROR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path); | 315 | log_write(LOG_LEVEL_ERROR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path); |
316 | logger_kill(logger); | ||
308 | return 1; | 317 | return 1; |
309 | } | 318 | } |
310 | 319 | ||