summaryrefslogtreecommitdiff
path: root/other/DHT_bootstrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'other/DHT_bootstrap.c')
-rw-r--r--other/DHT_bootstrap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 33ca45c2..bbb4844e 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -60,7 +60,7 @@ static void manage_keys(DHT *dht)
60 60
61 FILE *keys_file = fopen("key", "r"); 61 FILE *keys_file = fopen("key", "r");
62 62
63 if (keys_file != NULL) { 63 if (keys_file != nullptr) {
64 /* If file was opened successfully -- load keys, 64 /* If file was opened successfully -- load keys,
65 otherwise save new keys */ 65 otherwise save new keys */
66 size_t read_size = fread(keys, sizeof(uint8_t), KEYS_SIZE, keys_file); 66 size_t read_size = fread(keys, sizeof(uint8_t), KEYS_SIZE, keys_file);
@@ -78,7 +78,7 @@ static void manage_keys(DHT *dht)
78 memcpy(keys + CRYPTO_PUBLIC_KEY_SIZE, dht_get_self_secret_key(dht), CRYPTO_SECRET_KEY_SIZE); 78 memcpy(keys + CRYPTO_PUBLIC_KEY_SIZE, dht_get_self_secret_key(dht), CRYPTO_SECRET_KEY_SIZE);
79 keys_file = fopen("key", "w"); 79 keys_file = fopen("key", "w");
80 80
81 if (keys_file == NULL) { 81 if (keys_file == nullptr) {
82 printf("Error opening key file in write mode.\nKeys will not be saved.\n"); 82 printf("Error opening key file in write mode.\nKeys will not be saved.\n");
83 return; 83 return;
84 } 84 }
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
115 IP ip; 115 IP ip;
116 ip_init(&ip, ipv6enabled); 116 ip_init(&ip, ipv6enabled);
117 117
118 DHT *dht = new_DHT(NULL, new_networking(NULL, ip, PORT), true); 118 DHT *dht = new_DHT(nullptr, new_networking(nullptr, ip, PORT), true);
119 Onion *onion = new_onion(dht); 119 Onion *onion = new_onion(dht);
120 Onion_Announce *onion_a = new_onion_announce(dht); 120 Onion_Announce *onion_a = new_onion_announce(dht);
121 121
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
139 uint16_t ports[NUM_PORTS] = {443, 3389, PORT}; 139 uint16_t ports[NUM_PORTS] = {443, 3389, PORT};
140 TCP_Server *tcp_s = new_TCP_server(ipv6enabled, NUM_PORTS, ports, dht_get_self_secret_key(dht), onion); 140 TCP_Server *tcp_s = new_TCP_server(ipv6enabled, NUM_PORTS, ports, dht_get_self_secret_key(dht), onion);
141 141
142 if (tcp_s == NULL) { 142 if (tcp_s == nullptr) {
143 printf("TCP server failed to initialize.\n"); 143 printf("TCP server failed to initialize.\n");
144 exit(1); 144 exit(1);
145 } 145 }
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
149 const char *const public_id_filename = "PUBLIC_ID.txt"; 149 const char *const public_id_filename = "PUBLIC_ID.txt";
150 FILE *file = fopen(public_id_filename, "w"); 150 FILE *file = fopen(public_id_filename, "w");
151 151
152 if (file == NULL) { 152 if (file == nullptr) {
153 printf("Could not open file \"%s\" for writing. Exiting...\n", public_id_filename); 153 printf("Could not open file \"%s\" for writing. Exiting...\n", public_id_filename);
154 exit(1); 154 exit(1);
155 } 155 }
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
200#ifdef TCP_RELAY_ENABLED 200#ifdef TCP_RELAY_ENABLED
201 do_TCP_server(tcp_s); 201 do_TCP_server(tcp_s);
202#endif 202#endif
203 networking_poll(dht_get_net(dht), NULL); 203 networking_poll(dht_get_net(dht), nullptr);
204 204
205 c_sleep(1); 205 c_sleep(1);
206 } 206 }