summaryrefslogtreecommitdiff
path: root/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c')
-rw-r--r--other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c
index eec4e39f..0f39285b 100644
--- a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c
+++ b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c
@@ -74,7 +74,7 @@ int b16_to_key(char b16_string[], uint8_t *bs_pubkey)
74 74
75/* 75/*
76 resolve_addr(): 76 resolve_addr():
77 address should represent IPv4 or a hostname with A record 77 address should represent IPv4 or a hostname with a record
78 78
79 returns a data in network byte order that can be used to set IP.i or IP_Port.ip.i 79 returns a data in network byte order that can be used to set IP.i or IP_Port.ip.i
80 returns 0 on failure 80 returns 0 on failure
@@ -91,7 +91,7 @@ uint32_t resolve_addr(const char *address)
91 91
92 memset(&hints, 0, sizeof(hints)); 92 memset(&hints, 0, sizeof(hints));
93 hints.ai_family = AF_INET; // IPv4 only right now. 93 hints.ai_family = AF_INET; // IPv4 only right now.
94 hints.ai_socktype = SOCK_DGRAM; // type of socket Tox uses. 94 hints.ai_socktype = SOCK_DGRAM; // Type of socket Tox uses.
95 95
96 rc = getaddrinfo(address, "echo", &hints, &server); 96 rc = getaddrinfo(address, "echo", &hints, &server);
97 97
@@ -113,7 +113,7 @@ uint32_t resolve_addr(const char *address)
113 return addr; 113 return addr;
114} 114}
115 115
116/* This unction connects to all specified servers 116/* This function connects to all specified servers
117and connect to them. 117and connect to them.
118returns 1 if the connection to the DHT is up 118returns 1 if the connection to the DHT is up
119returns -1 if all attempts failed 119returns -1 if all attempts failed
@@ -178,7 +178,7 @@ void manage_keys(DHT *dht, char *keys_file)
178 load_keys(dht->c, keys); 178 load_keys(dht->c, keys);
179 179
180 } else { 180 } else {
181 /* otherwise save new keys */ 181 /* Otherwise save new keys */
182 /* Silly work-around to ignore any errors coming from new_keys() */ 182 /* Silly work-around to ignore any errors coming from new_keys() */
183 new_keys(dht->c); 183 new_keys(dht->c);
184 save_keys(dht->c, keys); 184 save_keys(dht->c, keys);
@@ -273,7 +273,7 @@ struct server_conf_s configure_server(char *cfg_file)
273 273
274 for (i = 0; i < count; ++i) { 274 for (i = 0; i < count; ++i) {
275 config_setting_t *server = config_setting_get_elem(server_list, i); 275 config_setting_t *server = config_setting_get_elem(server_list, i);
276 /* Get a pointer on the key aray */ 276 /* Get a pointer on the key array */
277 uint8_t *bs_pk_p = server_conf.info[i].bs_pk; 277 uint8_t *bs_pk_p = server_conf.info[i].bs_pk;
278 278
279 /* Only output the record if all of the expected fields are present. */ 279 /* Only output the record if all of the expected fields are present. */
@@ -288,17 +288,17 @@ struct server_conf_s configure_server(char *cfg_file)
288 288
289 if (resolve_addr(strcpy(tmp_ip, bs_ip)) == 0) { 289 if (resolve_addr(strcpy(tmp_ip, bs_ip)) == 0) {
290 server_conf.info[i].valid = 0; 290 server_conf.info[i].valid = 0;
291 printf("bootstrap_server %d: Invalid IP\n", i); 291 printf("bootstrap_server %d: Invalid IP.\n", i);
292 } 292 }
293 293
294 if (strlen(bs_pk) != 64) { 294 if (strlen(bs_pk) != 64) {
295 server_conf.info[i].valid = 0; 295 server_conf.info[i].valid = 0;
296 printf("bootstrap_server %d: Invalid public key\n", i); 296 printf("bootstrap_server %d: Invalid public key.\n", i);
297 } 297 }
298 298
299 if (!bs_port) { 299 if (!bs_port) {
300 server_conf.info[i].valid = 0; 300 server_conf.info[i].valid = 0;
301 printf("bootstrap_server %d: Invalid port\n", i); 301 printf("bootstrap_server %d: Invalid port.\n", i);
302 } 302 }
303 303
304 server_conf.info[i].conn.ip.i = resolve_addr(strcpy(tmp_ip, bs_ip)); 304 server_conf.info[i].conn.ip.i = resolve_addr(strcpy(tmp_ip, bs_ip));
@@ -337,7 +337,7 @@ int main(int argc, char *argv[])
337 337
338 server_conf = configure_server(argv[1]); 338 server_conf = configure_server(argv[1]);
339 339
340 /* initialize networking 340 /* Initialize networking
341 bind to ip 0.0.0.0:PORT */ 341 bind to ip 0.0.0.0:PORT */
342 IP ip; 342 IP ip;
343 ip.i = 0; 343 ip.i = 0;
@@ -412,7 +412,7 @@ int main(int argc, char *argv[])
412 /* If we got a good PID, then 412 /* If we got a good PID, then
413 we can exit the parent process. */ 413 we can exit the parent process. */
414 if (pid > 0) { 414 if (pid > 0) {
415 printf("Forked successfully: %d\n", pid); 415 printf("Forked successfully: %d.\n", pid);
416 416
417 /* Write the PID file */ 417 /* Write the PID file */
418 fprintf(pidf, "%d\n", pid); 418 fprintf(pidf, "%d\n", pid);