mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
networking_poll: DHT_bootstrap_daemon
This commit is contained in:
parent
6052b1f119
commit
448d0124cd
|
@ -81,10 +81,6 @@ int connect_to_servers(struct server_info_s *info)
|
||||||
int i;
|
int i;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
IP_Port ip_port;
|
|
||||||
uint8_t data[MAX_UDP_PACKET_SIZE];
|
|
||||||
uint32_t length;
|
|
||||||
|
|
||||||
for(i = 0; i < 32; ++i) {
|
for(i = 0; i < 32; ++i) {
|
||||||
if(info[i].valid) {
|
if(info[i].valid) {
|
||||||
/* Actual bootstrapping code goes here */
|
/* Actual bootstrapping code goes here */
|
||||||
|
@ -109,10 +105,7 @@ int connect_to_servers(struct server_info_s *info)
|
||||||
|
|
||||||
doDHT();
|
doDHT();
|
||||||
|
|
||||||
while(receivepacket(&ip_port, data, &length) != -1)
|
networking_poll();
|
||||||
{
|
|
||||||
DHT_handlepacket(data, length, ip_port);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This probably never happens */
|
/* This probably never happens */
|
||||||
|
@ -337,6 +330,7 @@ int main(int argc, char *argv[]) {
|
||||||
/* Bootstrap the DHT
|
/* Bootstrap the DHT
|
||||||
This one throws odd errors, too. Ignore. I assume they come
|
This one throws odd errors, too. Ignore. I assume they come
|
||||||
from somewhere in the core. */
|
from somewhere in the core. */
|
||||||
|
DHT_init();
|
||||||
tmperr = errno;
|
tmperr = errno;
|
||||||
connect_to_servers(server_conf.info);
|
connect_to_servers(server_conf.info);
|
||||||
errno = tmperr;
|
errno = tmperr;
|
||||||
|
@ -400,19 +394,13 @@ int main(int argc, char *argv[]) {
|
||||||
close(STDERR_FILENO);
|
close(STDERR_FILENO);
|
||||||
|
|
||||||
/* Main loop */
|
/* Main loop */
|
||||||
IP_Port ip_port;
|
friendreq_init();
|
||||||
uint8_t data[MAX_UDP_PACKET_SIZE];
|
|
||||||
uint32_t length;
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
doDHT();
|
doDHT();
|
||||||
|
|
||||||
while(receivepacket(&ip_port, data, &length) != -1)
|
networking_poll();
|
||||||
{
|
|
||||||
DHT_handlepacket(data, length, ip_port);
|
|
||||||
friendreq_handlepacket(data, length, ip_port);
|
|
||||||
}
|
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user