diff options
Diffstat (limited to 'other')
-rw-r--r-- | other/DHT_bootstrap.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 654b759f..aed17020 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #include "../toxcore/DHT.h" | 33 | #include "../toxcore/DHT.h" |
34 | #include "../toxcore/LAN_discovery.h" | ||
34 | #include "../toxcore/friend_requests.h" | 35 | #include "../toxcore/friend_requests.h" |
35 | #include "../testing/misc_tools.c" | 36 | #include "../testing/misc_tools.c" |
36 | 37 | ||
@@ -123,6 +124,9 @@ int main(int argc, char *argv[]) | |||
123 | 124 | ||
124 | int is_waiting_for_dht_connection = 1; | 125 | int is_waiting_for_dht_connection = 1; |
125 | 126 | ||
127 | uint64_t last_LANdiscovery = 0; | ||
128 | LANdiscovery_init(dht); | ||
129 | |||
126 | while (1) { | 130 | while (1) { |
127 | if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { | 131 | if (is_waiting_for_dht_connection && DHT_isconnected(dht)) { |
128 | printf("Connected to other bootstrap server successfully.\n"); | 132 | printf("Connected to other bootstrap server successfully.\n"); |
@@ -130,6 +134,10 @@ int main(int argc, char *argv[]) | |||
130 | } | 134 | } |
131 | 135 | ||
132 | do_DHT(dht); | 136 | do_DHT(dht); |
137 | if (last_LANdiscovery + (is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL) < unix_time()) { | ||
138 | send_LANdiscovery(htons(PORT), dht->c); | ||
139 | last_LANdiscovery = unix_time(); | ||
140 | } | ||
133 | 141 | ||
134 | networking_poll(dht->c->lossless_udp->net); | 142 | networking_poll(dht->c->lossless_udp->net); |
135 | 143 | ||