Enabled onion in bootstrap_serverdaemon.

This commit is contained in:
irungentoo 2014-01-20 13:05:34 -05:00
parent aff6b112c0
commit 522f90fee1
3 changed files with 16 additions and 4 deletions

View File

@ -109,6 +109,7 @@ int main(int argc, char *argv[])
printf("Something failed to initialize.\n");
exit(1);
}
perror("Initialization");
manage_keys(dht);

View File

@ -283,7 +283,7 @@ int try_connect(DHT *dht, int port, int enable_lan_discovery)
do_DHT(dht);
if (enable_lan_discovery) {
send_LANdiscovery(htons_port, dht->c);
send_LANdiscovery(htons_port, dht);
}
networking_poll(dht->c->lossless_udp->net);
@ -358,12 +358,19 @@ int main(int argc, char *argv[])
ip_init(&ip, enable_ipv6);
DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port)));
Onion *onion = new_onion(dht);
Onion_Announce *onion_a = new_onion_announce(dht);
if (dht == NULL) {
syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n");
return 1;
}
if (!(onion && onion_a)) {
syslog(LOG_ERR, "Couldn't initialize Tox onion stuff. Exiting.\n");
return 1;
}
if (enable_lan_discovery) {
LANdiscovery_init(dht);
}
@ -375,6 +382,10 @@ int main(int argc, char *argv[])
return 1;
}
/* We want our DHT public key to be the same as our internal one since this is a bootstrap server */
memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES);
memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES);
if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n");
} else {
@ -446,11 +457,11 @@ int main(int argc, char *argv[])
do_DHT(dht);
if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) {
send_LANdiscovery(htons_port, dht->c);
send_LANdiscovery(htons_port, dht);
last_LANdiscovery = unix_time();
}
networking_poll(dht->c->lossless_udp->net);
networking_poll(dht->net);
sleep;
}