diff options
Diffstat (limited to 'toxcore/LAN_discovery.c')
-rw-r--r-- | toxcore/LAN_discovery.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index eadec9ec..bed14754 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -220,33 +220,33 @@ static int handle_LANdiscovery(void *object, IP_Port source, uint8_t *packet, ui | |||
220 | } | 220 | } |
221 | 221 | ||
222 | 222 | ||
223 | int send_LANdiscovery(uint16_t port, Net_Crypto *c) | 223 | int send_LANdiscovery(uint16_t port, DHT *dht) |
224 | { | 224 | { |
225 | uint8_t data[crypto_box_PUBLICKEYBYTES + 1]; | 225 | uint8_t data[crypto_box_PUBLICKEYBYTES + 1]; |
226 | data[0] = NET_PACKET_LAN_DISCOVERY; | 226 | data[0] = NET_PACKET_LAN_DISCOVERY; |
227 | id_copy(data + 1, c->self_public_key); | 227 | id_copy(data + 1, dht->self_public_key); |
228 | 228 | ||
229 | #ifdef __linux | 229 | #ifdef __linux |
230 | send_broadcasts(c->lossless_udp->net, port, data, 1 + crypto_box_PUBLICKEYBYTES); | 230 | send_broadcasts(dht->net, port, data, 1 + crypto_box_PUBLICKEYBYTES); |
231 | #endif | 231 | #endif |
232 | int res = -1; | 232 | int res = -1; |
233 | IP_Port ip_port; | 233 | IP_Port ip_port; |
234 | ip_port.port = port; | 234 | ip_port.port = port; |
235 | 235 | ||
236 | /* IPv6 multicast */ | 236 | /* IPv6 multicast */ |
237 | if (c->lossless_udp->net->family == AF_INET6) { | 237 | if (dht->net->family == AF_INET6) { |
238 | ip_port.ip = broadcast_ip(AF_INET6, AF_INET6); | 238 | ip_port.ip = broadcast_ip(AF_INET6, AF_INET6); |
239 | 239 | ||
240 | if (ip_isset(&ip_port.ip)) | 240 | if (ip_isset(&ip_port.ip)) |
241 | if (sendpacket(c->lossless_udp->net, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES) > 0) | 241 | if (sendpacket(dht->net, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES) > 0) |
242 | res = 1; | 242 | res = 1; |
243 | } | 243 | } |
244 | 244 | ||
245 | /* IPv4 broadcast (has to be IPv4-in-IPv6 mapping if socket is AF_INET6 */ | 245 | /* IPv4 broadcast (has to be IPv4-in-IPv6 mapping if socket is AF_INET6 */ |
246 | ip_port.ip = broadcast_ip(c->lossless_udp->net->family, AF_INET); | 246 | ip_port.ip = broadcast_ip(dht->net->family, AF_INET); |
247 | 247 | ||
248 | if (ip_isset(&ip_port.ip)) | 248 | if (ip_isset(&ip_port.ip)) |
249 | if (sendpacket(c->lossless_udp->net, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES)) | 249 | if (sendpacket(dht->net, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES)) |
250 | res = 1; | 250 | res = 1; |
251 | 251 | ||
252 | return res; | 252 | return res; |
@@ -255,5 +255,5 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c) | |||
255 | 255 | ||
256 | void LANdiscovery_init(DHT *dht) | 256 | void LANdiscovery_init(DHT *dht) |
257 | { | 257 | { |
258 | networking_registerhandler(dht->c->lossless_udp->net, NET_PACKET_LAN_DISCOVERY, &handle_LANdiscovery, dht); | 258 | networking_registerhandler(dht->net, NET_PACKET_LAN_DISCOVERY, &handle_LANdiscovery, dht); |
259 | } | 259 | } |