summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslvr <slvr@unsafeio.com>2013-08-10 00:49:20 +0100
committerslvr <slvr@unsafeio.com>2013-08-10 00:49:20 +0100
commit448d0124cdb98142a0fa89087a6b49b0c6063700 (patch)
tree05a1a17020013ff098188c98a3af6375ae724b2f
parent6052b1f119d2b1494a7f2691f4dfed235b560636 (diff)
networking_poll: DHT_bootstrap_daemon
-rw-r--r--other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c20
1 files changed, 4 insertions, 16 deletions
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