summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r--toxcore/net_crypto.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index 811dbf1a..47b23d54 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -1329,10 +1329,10 @@ static int crypto_connection_add_source(Net_Crypto *c, int crypt_connection_id,
1329 1329
1330 if (source.ip.family == AF_INET || source.ip.family == AF_INET6) { 1330 if (source.ip.family == AF_INET || source.ip.family == AF_INET6) {
1331 if (!ipport_equal(&source, &conn->ip_port)) { 1331 if (!ipport_equal(&source, &conn->ip_port)) {
1332 if (!list_add(&c->ip_port_list, &source, crypt_connection_id)) 1332 if (!bs_list_add(&c->ip_port_list, &source, crypt_connection_id))
1333 return -1; 1333 return -1;
1334 1334
1335 list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); 1335 bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id);
1336 conn->ip_port = source; 1336 conn->ip_port = source;
1337 } 1337 }
1338 1338
@@ -1609,8 +1609,8 @@ int set_direct_ip_port(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port)
1609 return -1; 1609 return -1;
1610 1610
1611 if (!ipport_equal(&ip_port, &conn->ip_port)) { 1611 if (!ipport_equal(&ip_port, &conn->ip_port)) {
1612 if (list_add(&c->ip_port_list, &ip_port, crypt_connection_id)) { 1612 if (bs_list_add(&c->ip_port_list, &ip_port, crypt_connection_id)) {
1613 list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); 1613 bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id);
1614 conn->ip_port = ip_port; 1614 conn->ip_port = ip_port;
1615 conn->direct_lastrecv_time = 0; 1615 conn->direct_lastrecv_time = 0;
1616 return 0; 1616 return 0;
@@ -2103,7 +2103,7 @@ int connection_lossy_data_handler(Net_Crypto *c, int crypt_connection_id,
2103 */ 2103 */
2104static int crypto_id_ip_port(Net_Crypto *c, IP_Port ip_port) 2104static int crypto_id_ip_port(Net_Crypto *c, IP_Port ip_port)
2105{ 2105{
2106 return list_find(&c->ip_port_list, &ip_port); 2106 return bs_list_find(&c->ip_port_list, &ip_port);
2107} 2107}
2108 2108
2109#define CRYPTO_MIN_PACKET_SIZE (1 + sizeof(uint16_t) + crypto_box_MACBYTES) 2109#define CRYPTO_MIN_PACKET_SIZE (1 + sizeof(uint16_t) + crypto_box_MACBYTES)
@@ -2426,7 +2426,7 @@ int crypto_kill(Net_Crypto *c, int crypt_connection_id)
2426 2426
2427 send_kill_packet(c, crypt_connection_id); 2427 send_kill_packet(c, crypt_connection_id);
2428 disconnect_peer_tcp(c, crypt_connection_id); 2428 disconnect_peer_tcp(c, crypt_connection_id);
2429 list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); 2429 bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id);
2430 return wipe_crypto_connection(c, crypt_connection_id); 2430 return wipe_crypto_connection(c, crypt_connection_id);
2431} 2431}
2432 2432
@@ -2499,7 +2499,7 @@ Net_Crypto *new_net_crypto(DHT *dht)
2499 networking_registerhandler(dht->net, NET_PACKET_CRYPTO_HS, &udp_handle_packet, temp); 2499 networking_registerhandler(dht->net, NET_PACKET_CRYPTO_HS, &udp_handle_packet, temp);
2500 networking_registerhandler(dht->net, NET_PACKET_CRYPTO_DATA, &udp_handle_packet, temp); 2500 networking_registerhandler(dht->net, NET_PACKET_CRYPTO_DATA, &udp_handle_packet, temp);
2501 2501
2502 list_init(&temp->ip_port_list, sizeof(IP_Port)); 2502 bs_list_init(&temp->ip_port_list, sizeof(IP_Port));
2503 return temp; 2503 return temp;
2504} 2504}
2505 2505
@@ -2573,7 +2573,7 @@ void kill_net_crypto(Net_Crypto *c)
2573 kill_TCP_connection(c->tcp_connections[i]); 2573 kill_TCP_connection(c->tcp_connections[i]);
2574 } 2574 }
2575 2575
2576 list_free(&c->ip_port_list); 2576 bs_list_free(&c->ip_port_list);
2577 networking_registerhandler(c->dht->net, NET_PACKET_COOKIE_REQUEST, NULL, NULL); 2577 networking_registerhandler(c->dht->net, NET_PACKET_COOKIE_REQUEST, NULL, NULL);
2578 networking_registerhandler(c->dht->net, NET_PACKET_COOKIE_RESPONSE, NULL, NULL); 2578 networking_registerhandler(c->dht->net, NET_PACKET_COOKIE_RESPONSE, NULL, NULL);
2579 networking_registerhandler(c->dht->net, NET_PACKET_CRYPTO_HS, NULL, NULL); 2579 networking_registerhandler(c->dht->net, NET_PACKET_CRYPTO_HS, NULL, NULL);