summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-15 01:23:08 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-16 20:06:07 +0000
commit643eea60bb9dcf4ecb33d64666b1bc77cbfd7438 (patch)
tree2f98b0c7869fddac03f834be508a182da06f07b4 /other/bootstrap_daemon
parent22db2b9fe581a35300b66126604d12e83c2eafb1 (diff)
Make DHT a module-private type.
Diffstat (limited to 'other/bootstrap_daemon')
-rw-r--r--other/bootstrap_daemon/src/tox-bootstrapd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c
index c6780fa3..e0472cba 100644
--- a/other/bootstrap_daemon/src/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/src/tox-bootstrapd.c
@@ -73,12 +73,12 @@ static int manage_keys(DHT *dht, char *keys_file_path)
73 return 0; 73 return 0;
74 } 74 }
75 75
76 memcpy(dht->self_public_key, keys, CRYPTO_PUBLIC_KEY_SIZE); 76 dht_set_self_public_key(dht, keys);
77 memcpy(dht->self_secret_key, keys + CRYPTO_PUBLIC_KEY_SIZE, CRYPTO_SECRET_KEY_SIZE); 77 dht_set_self_secret_key(dht, keys + CRYPTO_PUBLIC_KEY_SIZE);
78 } else { 78 } else {
79 // Otherwise save new keys 79 // Otherwise save new keys
80 memcpy(keys, dht->self_public_key, CRYPTO_PUBLIC_KEY_SIZE); 80 memcpy(keys, dht_get_self_public_key(dht), CRYPTO_PUBLIC_KEY_SIZE);
81 memcpy(keys + CRYPTO_PUBLIC_KEY_SIZE, dht->self_secret_key, CRYPTO_SECRET_KEY_SIZE); 81 memcpy(keys + CRYPTO_PUBLIC_KEY_SIZE, dht_get_self_secret_key(dht), CRYPTO_SECRET_KEY_SIZE);
82 82
83 keys_file = fopen(keys_file_path, "w"); 83 keys_file = fopen(keys_file_path, "w");
84 84
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
261 } 261 }
262 262
263 if (enable_motd) { 263 if (enable_motd) {
264 if (bootstrap_set_callbacks(dht->net, DAEMON_VERSION_NUMBER, (uint8_t *)motd, strlen(motd) + 1) == 0) { 264 if (bootstrap_set_callbacks(dht_get_net(dht), DAEMON_VERSION_NUMBER, (uint8_t *)motd, strlen(motd) + 1) == 0) {
265 log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n"); 265 log_write(LOG_LEVEL_INFO, "Set MOTD successfully.\n");
266 } else { 266 } else {
267 log_write(LOG_LEVEL_ERROR, "Couldn't set MOTD: %s. Exiting.\n", motd); 267 log_write(LOG_LEVEL_ERROR, "Couldn't set MOTD: %s. Exiting.\n", motd);
@@ -288,7 +288,7 @@ int main(int argc, char *argv[])
288 return 1; 288 return 1;
289 } 289 }
290 290
291 tcp_server = new_TCP_server(enable_ipv6, tcp_relay_port_count, tcp_relay_ports, dht->self_secret_key, onion); 291 tcp_server = new_TCP_server(enable_ipv6, tcp_relay_port_count, tcp_relay_ports, dht_get_self_secret_key(dht), onion);
292 292
293 // tcp_relay_port_count != 0 at this point 293 // tcp_relay_port_count != 0 at this point
294 free(tcp_relay_ports); 294 free(tcp_relay_ports);
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
308 return 1; 308 return 1;
309 } 309 }
310 310
311 print_public_key(dht->self_public_key); 311 print_public_key(dht_get_self_public_key(dht));
312 312
313 uint64_t last_LANdiscovery = 0; 313 uint64_t last_LANdiscovery = 0;
314 const uint16_t net_htons_port = net_htons(port); 314 const uint16_t net_htons_port = net_htons(port);
@@ -332,7 +332,7 @@ int main(int argc, char *argv[])
332 do_TCP_server(tcp_server); 332 do_TCP_server(tcp_server);
333 } 333 }
334 334
335 networking_poll(dht->net, NULL); 335 networking_poll(dht_get_net(dht), NULL);
336 336
337 if (waiting_for_dht_connection && DHT_isconnected(dht)) { 337 if (waiting_for_dht_connection && DHT_isconnected(dht)) {
338 log_write(LOG_LEVEL_INFO, "Connected to another bootstrap node successfully.\n"); 338 log_write(LOG_LEVEL_INFO, "Connected to another bootstrap node successfully.\n");