summaryrefslogtreecommitdiff
path: root/other/bootstrap_serverdaemon
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-01-20 13:05:34 -0500
committerirungentoo <irungentoo@gmail.com>2014-01-20 13:05:34 -0500
commit522f90fee138087db660dccc08413c53f388f604 (patch)
treec2059983a8c5a7c3a60e4c2e342aedf6dc2d5d7f /other/bootstrap_serverdaemon
parentaff6b112c00a9bed01c1e030ede91ef9bc7753d6 (diff)
Enabled onion in bootstrap_serverdaemon.
Diffstat (limited to 'other/bootstrap_serverdaemon')
-rw-r--r--other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c b/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c
index 3c6d7b4e..5fbe83fa 100644
--- a/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c
+++ b/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c
@@ -283,7 +283,7 @@ int try_connect(DHT *dht, int port, int enable_lan_discovery)
283 do_DHT(dht); 283 do_DHT(dht);
284 284
285 if (enable_lan_discovery) { 285 if (enable_lan_discovery) {
286 send_LANdiscovery(htons_port, dht->c); 286 send_LANdiscovery(htons_port, dht);
287 } 287 }
288 288
289 networking_poll(dht->c->lossless_udp->net); 289 networking_poll(dht->c->lossless_udp->net);
@@ -358,12 +358,19 @@ int main(int argc, char *argv[])
358 ip_init(&ip, enable_ipv6); 358 ip_init(&ip, enable_ipv6);
359 359
360 DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port))); 360 DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port)));
361 Onion *onion = new_onion(dht);
362 Onion_Announce *onion_a = new_onion_announce(dht);
361 363
362 if (dht == NULL) { 364 if (dht == NULL) {
363 syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n"); 365 syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n");
364 return 1; 366 return 1;
365 } 367 }
366 368
369 if (!(onion && onion_a)) {
370 syslog(LOG_ERR, "Couldn't initialize Tox onion stuff. Exiting.\n");
371 return 1;
372 }
373
367 if (enable_lan_discovery) { 374 if (enable_lan_discovery) {
368 LANdiscovery_init(dht); 375 LANdiscovery_init(dht);
369 } 376 }
@@ -375,6 +382,10 @@ int main(int argc, char *argv[])
375 return 1; 382 return 1;
376 } 383 }
377 384
385 /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */
386 memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
387 memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
388
378 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { 389 if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
379 syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); 390 syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n");
380 } else { 391 } else {
@@ -446,11 +457,11 @@ int main(int argc, char *argv[])
446 do_DHT(dht); 457 do_DHT(dht);
447 458
448 if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { 459 if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) {
449 send_LANdiscovery(htons_port, dht->c); 460 send_LANdiscovery(htons_port, dht);
450 last_LANdiscovery = unix_time(); 461 last_LANdiscovery = unix_time();
451 } 462 }
452 463
453 networking_poll(dht->c->lossless_udp->net); 464 networking_poll(dht->net);
454 465
455 sleep; 466 sleep;
456 } 467 }