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");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
perror("Initialization");
|
||||
|
||||
manage_keys(dht);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ static int handle_dht_fakeid(void *object, IP_Port source, uint8_t *source_pubke
|
||||
|
||||
if ((uint32_t)len != length - (DATA_IN_RESPONSE_MIN_SIZE + crypto_box_NONCEBYTES))
|
||||
return 1;
|
||||
|
||||
|
||||
if (memcpy(source_pubkey, packet, crypto_box_PUBLICKEYBYTES) != 0)
|
||||
return 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user