diff options
Diffstat (limited to 'other')
-rw-r--r-- | other/DHT_bootstrap.c | 12 | ||||
-rw-r--r-- | other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | 20 |
2 files changed, 8 insertions, 24 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index befe2225..4b0adeff 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -113,9 +113,8 @@ int main(int argc, char *argv[]) | |||
113 | free(bootstrap_key); | 113 | free(bootstrap_key); |
114 | } | 114 | } |
115 | 115 | ||
116 | IP_Port ip_port; | 116 | DHT_init(); |
117 | uint8_t data[MAX_UDP_PACKET_SIZE]; | 117 | friendreq_init(); |
118 | uint32_t length; | ||
119 | 118 | ||
120 | int is_waiting_for_dht_connection = 1; | 119 | int is_waiting_for_dht_connection = 1; |
121 | while(1) | 120 | while(1) |
@@ -127,11 +126,8 @@ int main(int argc, char *argv[]) | |||
127 | } | 126 | } |
128 | doDHT(); | 127 | doDHT(); |
129 | 128 | ||
130 | while(receivepacket(&ip_port, data, &length) != -1) | 129 | networking_poll(); |
131 | { | 130 | |
132 | DHT_handlepacket(data, length, ip_port); | ||
133 | friendreq_handlepacket(data, length, ip_port); | ||
134 | } | ||
135 | c_sleep(1); | 131 | c_sleep(1); |
136 | } | 132 | } |
137 | shutdown_networking(); | 133 | shutdown_networking(); |
diff --git a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c index 48152744..6ce542c1 100644 --- a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c +++ b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | |||
@@ -81,10 +81,6 @@ int connect_to_servers(struct server_info_s *info) | |||
81 | int i; | 81 | int i; |
82 | int c; | 82 | int c; |
83 | 83 | ||
84 | IP_Port ip_port; | ||
85 | uint8_t data[MAX_UDP_PACKET_SIZE]; | ||
86 | uint32_t length; | ||
87 | |||
88 | for(i = 0; i < 32; ++i) { | 84 | for(i = 0; i < 32; ++i) { |
89 | if(info[i].valid) { | 85 | if(info[i].valid) { |
90 | /* Actual bootstrapping code goes here */ | 86 | /* Actual bootstrapping code goes here */ |
@@ -109,10 +105,7 @@ int connect_to_servers(struct server_info_s *info) | |||
109 | 105 | ||
110 | doDHT(); | 106 | doDHT(); |
111 | 107 | ||
112 | while(receivepacket(&ip_port, data, &length) != -1) | 108 | networking_poll(); |
113 | { | ||
114 | DHT_handlepacket(data, length, ip_port); | ||
115 | } | ||
116 | } | 109 | } |
117 | 110 | ||
118 | /* This probably never happens */ | 111 | /* This probably never happens */ |
@@ -337,6 +330,7 @@ int main(int argc, char *argv[]) { | |||
337 | /* Bootstrap the DHT | 330 | /* Bootstrap the DHT |
338 | This one throws odd errors, too. Ignore. I assume they come | 331 | This one throws odd errors, too. Ignore. I assume they come |
339 | from somewhere in the core. */ | 332 | from somewhere in the core. */ |
333 | DHT_init(); | ||
340 | tmperr = errno; | 334 | tmperr = errno; |
341 | connect_to_servers(server_conf.info); | 335 | connect_to_servers(server_conf.info); |
342 | errno = tmperr; | 336 | errno = tmperr; |
@@ -400,19 +394,13 @@ int main(int argc, char *argv[]) { | |||
400 | close(STDERR_FILENO); | 394 | close(STDERR_FILENO); |
401 | 395 | ||
402 | /* Main loop */ | 396 | /* Main loop */ |
403 | IP_Port ip_port; | 397 | friendreq_init(); |
404 | uint8_t data[MAX_UDP_PACKET_SIZE]; | ||
405 | uint32_t length; | ||
406 | 398 | ||
407 | while(1) | 399 | while(1) |
408 | { | 400 | { |
409 | doDHT(); | 401 | doDHT(); |
410 | 402 | ||
411 | while(receivepacket(&ip_port, data, &length) != -1) | 403 | networking_poll(); |
412 | { | ||
413 | DHT_handlepacket(data, length, ip_port); | ||
414 | friendreq_handlepacket(data, length, ip_port); | ||
415 | } | ||
416 | usleep(10000); | 404 | usleep(10000); |
417 | } | 405 | } |
418 | 406 | ||