mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Enabled onion in bootstrap_serverdaemon.
This commit is contained in:
parent
aff6b112c0
commit
522f90fee1
@ -109,6 +109,7 @@ int main(int argc, char *argv[])
|
|||||||
printf("Something failed to initialize.\n");
|
printf("Something failed to initialize.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
perror("Initialization");
|
perror("Initialization");
|
||||||
|
|
||||||
manage_keys(dht);
|
manage_keys(dht);
|
||||||
|
@ -283,7 +283,7 @@ int try_connect(DHT *dht, int port, int enable_lan_discovery)
|
|||||||
do_DHT(dht);
|
do_DHT(dht);
|
||||||
|
|
||||||
if (enable_lan_discovery) {
|
if (enable_lan_discovery) {
|
||||||
send_LANdiscovery(htons_port, dht->c);
|
send_LANdiscovery(htons_port, dht);
|
||||||
}
|
}
|
||||||
|
|
||||||
networking_poll(dht->c->lossless_udp->net);
|
networking_poll(dht->c->lossless_udp->net);
|
||||||
@ -358,12 +358,19 @@ int main(int argc, char *argv[])
|
|||||||
ip_init(&ip, enable_ipv6);
|
ip_init(&ip, enable_ipv6);
|
||||||
|
|
||||||
DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port)));
|
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) {
|
if (dht == NULL) {
|
||||||
syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n");
|
syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(onion && onion_a)) {
|
||||||
|
syslog(LOG_ERR, "Couldn't initialize Tox onion stuff. Exiting.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (enable_lan_discovery) {
|
if (enable_lan_discovery) {
|
||||||
LANdiscovery_init(dht);
|
LANdiscovery_init(dht);
|
||||||
}
|
}
|
||||||
@ -375,6 +382,10 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
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)) {
|
if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) {
|
||||||
syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n");
|
syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n");
|
||||||
} else {
|
} else {
|
||||||
@ -446,11 +457,11 @@ int main(int argc, char *argv[])
|
|||||||
do_DHT(dht);
|
do_DHT(dht);
|
||||||
|
|
||||||
if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) {
|
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();
|
last_LANdiscovery = unix_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
networking_poll(dht->c->lossless_udp->net);
|
networking_poll(dht->net);
|
||||||
|
|
||||||
sleep;
|
sleep;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user