mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed build errors.
This commit is contained in:
parent
790867d984
commit
25563ac070
|
@ -84,7 +84,7 @@ int main(int argc, char *argv[])
|
|||
/* Initialize networking -
|
||||
Bind to ip 0.0.0.0:PORT */
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT)));
|
||||
manage_keys(dht);
|
||||
printf("Public key: ");
|
||||
|
@ -111,7 +111,7 @@ int main(int argc, char *argv[])
|
|||
if (argc > 3) {
|
||||
printf("Trying to bootstrap into the network...\n");
|
||||
IP_Port bootstrap_info;
|
||||
bootstrap_info.ip.i = inet_addr(argv[1]);
|
||||
bootstrap_info.ip.uint32 = inet_addr(argv[1]);
|
||||
bootstrap_info.port = htons(atoi(argv[2]));
|
||||
uint8_t *bootstrap_key = hex_string_to_bin(argv[3]);
|
||||
DHT_bootstrap(dht, bootstrap_info, bootstrap_key);
|
||||
|
|
|
@ -301,7 +301,7 @@ struct server_conf_s configure_server(char *cfg_file)
|
|||
printf("bootstrap_server %d: Invalid port.\n", i);
|
||||
}
|
||||
|
||||
server_conf.info[i].conn.ip.i = resolve_addr(strcpy(tmp_ip, bs_ip));
|
||||
server_conf.info[i].conn.ip.uint32 = resolve_addr(strcpy(tmp_ip, bs_ip));
|
||||
server_conf.info[i].conn.port = htons(bs_port);
|
||||
b16_to_key(strcpy(tmp_pk, bs_pk), bs_pk_p);
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ int main(int argc, char *argv[])
|
|||
/* Initialize networking
|
||||
bind to ip 0.0.0.0:PORT */
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
DHT *dht = new_DHT(new_net_crypto(new_networking(ip, server_conf.port)));
|
||||
/* Read the config file */
|
||||
printf("PID file: %s\n", server_conf.pid_file);
|
||||
|
|
|
@ -62,11 +62,11 @@ void print_clientlist(DHT *dht)
|
|||
}
|
||||
|
||||
p_ip = dht->close_clientlist[i].ip_port;
|
||||
printf("\nIP: %u.%u.%u.%u Port: %u", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
|
||||
printf("\nIP: %u.%u.%u.%u Port: %u", p_ip.ip.uint8[0], p_ip.ip.uint8[1], p_ip.ip.uint8[2], p_ip.ip.uint8[3], ntohs(p_ip.port));
|
||||
printf("\nTimestamp: %llu", (long long unsigned int) dht->close_clientlist[i].timestamp);
|
||||
printf("\nLast pinged: %llu\n", (long long unsigned int) dht->close_clientlist[i].last_pinged);
|
||||
p_ip = dht->close_clientlist[i].ret_ip_port;
|
||||
printf("OUR IP: %u.%u.%u.%u Port: %u\n", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
|
||||
printf("OUR IP: %u.%u.%u.%u Port: %u\n", p_ip.ip.uint8[0], p_ip.ip.uint8[1], p_ip.ip.uint8[2], p_ip.ip.uint8[3], ntohs(p_ip.port));
|
||||
printf("Timestamp: %llu\n", (long long unsigned int) dht->close_clientlist[i].ret_timestamp);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ void print_friendlist(DHT *dht)
|
|||
}
|
||||
|
||||
p_ip = DHT_getfriendip(dht, dht->friends_list[k].client_id);
|
||||
printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
|
||||
printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.uint8[0], p_ip.ip.uint8[1], p_ip.ip.uint8[2], p_ip.ip.uint8[3], ntohs(p_ip.port));
|
||||
|
||||
printf("\nCLIENTS IN LIST:\n\n");
|
||||
|
||||
|
@ -101,11 +101,11 @@ void print_friendlist(DHT *dht)
|
|||
}
|
||||
|
||||
p_ip = dht->friends_list[k].client_list[i].ip_port;
|
||||
printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
|
||||
printf("\nIP: %u.%u.%u.%u:%u", p_ip.ip.uint8[0], p_ip.ip.uint8[1], p_ip.ip.uint8[2], p_ip.ip.uint8[3], ntohs(p_ip.port));
|
||||
printf("\nTimestamp: %llu", (long long unsigned int) dht->friends_list[k].client_list[i].timestamp);
|
||||
printf("\nLast pinged: %llu\n", (long long unsigned int) dht->friends_list[k].client_list[i].last_pinged);
|
||||
p_ip = dht->friends_list[k].client_list[i].ret_ip_port;
|
||||
printf("ret IP: %u.%u.%u.%u:%u\n", p_ip.ip.c[0], p_ip.ip.c[1], p_ip.ip.c[2], p_ip.ip.c[3], ntohs(p_ip.port));
|
||||
printf("ret IP: %u.%u.%u.%u:%u\n", p_ip.ip.uint8[0], p_ip.ip.uint8[1], p_ip.ip.uint8[2], p_ip.ip.uint8[3], ntohs(p_ip.port));
|
||||
printf("Timestamp: %llu\n", (long long unsigned int)dht->friends_list[k].client_list[i].ret_timestamp);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ int main(int argc, char *argv[])
|
|||
/* initialize networking */
|
||||
/* bind to ip 0.0.0.0:PORT */
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
|
||||
DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT)));
|
||||
|
||||
|
@ -169,7 +169,7 @@ int main(int argc, char *argv[])
|
|||
* bootstrap_ip_port.ip.c[1] = 0;
|
||||
* bootstrap_ip_port.ip.c[2] = 0;
|
||||
* bootstrap_ip_port.ip.c[3] = 1; */
|
||||
bootstrap_ip_port.ip.i = inet_addr(argv[1]);
|
||||
bootstrap_ip_port.ip.uint32 = inet_addr(argv[1]);
|
||||
DHT_bootstrap(dht, bootstrap_ip_port, hex_string_to_bin(argv[3]));
|
||||
|
||||
/*
|
||||
|
|
|
@ -62,7 +62,7 @@ void printpacket(uint8_t *data, uint32_t length, IP_Port ip_port)
|
|||
|
||||
void printip(IP_Port ip_port)
|
||||
{
|
||||
printf("\nIP: %u.%u.%u.%u Port: %u", ip_port.ip.c[0], ip_port.ip.c[1], ip_port.ip.c[2], ip_port.ip.c[3],
|
||||
printf("\nIP: %u.%u.%u.%u Port: %u", ip_port.ip.uint8[0], ip_port.ip.uint8[1], ip_port.ip.uint8[2], ip_port.ip.uint8[3],
|
||||
ntohs(ip_port.port));
|
||||
}
|
||||
/*
|
||||
|
@ -165,11 +165,11 @@ int main(int argc, char *argv[])
|
|||
/* initialize networking */
|
||||
/* bind to ip 0.0.0.0:PORT */
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
Lossless_UDP *ludp = new_lossless_udp(new_networking(ip, PORT));
|
||||
perror("Initialization");
|
||||
IP_Port serverip;
|
||||
serverip.ip.i = inet_addr(argv[1]);
|
||||
serverip.ip.uint32 = inet_addr(argv[1]);
|
||||
serverip.port = htons(atoi(argv[2]));
|
||||
printip(serverip);
|
||||
int connection = new_connection(ludp, serverip);
|
||||
|
|
|
@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
|||
//initialize networking
|
||||
//bind to ip 0.0.0.0:PORT
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
Lossless_UDP *ludp = new_lossless_udp(new_networking(ip, PORT));
|
||||
perror("Initialization");
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
|||
if (argc > 3) {
|
||||
IP_Port bootstrap_ip_port;
|
||||
bootstrap_ip_port.port = htons(atoi(argv[2]));
|
||||
bootstrap_ip_port.ip.i = inet_addr(argv[1]);
|
||||
bootstrap_ip_port.ip.uint32 = inet_addr(argv[1]);
|
||||
DHT_bootstrap(m->dht, bootstrap_ip_port, hex_string_to_bin(argv[3]));
|
||||
} else {
|
||||
FILE *file = fopen(argv[1], "rb");
|
||||
|
|
|
@ -88,7 +88,7 @@ static int id_closest(uint8_t *id, uint8_t *id1, uint8_t *id2)
|
|||
|
||||
static int ipport_equal(IP_Port a, IP_Port b)
|
||||
{
|
||||
return (a.ip.i == b.ip.i) && (a.port == b.port);
|
||||
return (a.ip.uint32 == b.ip.uint32) && (a.port == b.port);
|
||||
}
|
||||
|
||||
static int id_equal(uint8_t *a, uint8_t *b)
|
||||
|
@ -122,7 +122,7 @@ static int client_in_list(Client_data *list, uint32_t length, uint8_t *client_id
|
|||
if (id_equal(list[i].client_id, client_id)) {
|
||||
/* Refresh the client timestamp. */
|
||||
list[i].timestamp = temp_time;
|
||||
list[i].ip_port.ip.i = ip_port.ip.i;
|
||||
list[i].ip_port.ip.uint32 = ip_port.ip.uint32;
|
||||
list[i].ip_port.port = ip_port.port;
|
||||
return 1;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ static int replace_bad( Client_data *list,
|
|||
memcpy(list[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||
list[i].ip_port = ip_port;
|
||||
list[i].timestamp = temp_time;
|
||||
list[i].ret_ip_port.ip.i = 0;
|
||||
list[i].ret_ip_port.ip.uint32 = 0;
|
||||
list[i].ret_ip_port.port = 0;
|
||||
list[i].ret_timestamp = 0;
|
||||
return 0;
|
||||
|
@ -320,7 +320,7 @@ static int replace_good( Client_data *list,
|
|||
memcpy(list[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||
list[i].ip_port = ip_port;
|
||||
list[i].timestamp = temp_time;
|
||||
list[i].ret_ip_port.ip.i = 0;
|
||||
list[i].ret_ip_port.ip.uint32 = 0;
|
||||
list[i].ret_ip_port.port = 0;
|
||||
list[i].ret_timestamp = 0;
|
||||
return 0;
|
||||
|
@ -418,13 +418,13 @@ static int is_gettingnodes(DHT *dht, IP_Port ip_port, uint64_t ping_id)
|
|||
if (!is_timeout(temp_time, dht->send_nodes[i].timestamp, PING_TIMEOUT)) {
|
||||
pinging = 0;
|
||||
|
||||
if (ip_port.ip.i != 0 && ipport_equal(dht->send_nodes[i].ip_port, ip_port))
|
||||
if (ip_port.ip.uint32 != 0 && ipport_equal(dht->send_nodes[i].ip_port, ip_port))
|
||||
++pinging;
|
||||
|
||||
if (ping_id != 0 && dht->send_nodes[i].ping_id == ping_id)
|
||||
++pinging;
|
||||
|
||||
if (pinging == (ping_id != 0) + (ip_port.ip.i != 0))
|
||||
if (pinging == (ping_id != 0) + (ip_port.ip.uint32 != 0))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -690,7 +690,7 @@ IP_Port DHT_getfriendip(DHT *dht, uint8_t *client_id)
|
|||
}
|
||||
}
|
||||
|
||||
empty.ip.i = 1;
|
||||
empty.ip.uint32 = 1;
|
||||
return empty;
|
||||
}
|
||||
|
||||
|
@ -814,7 +814,7 @@ static int friend_iplist(DHT *dht, IP_Port *ip_portlist, uint16_t friend_num)
|
|||
client = &friend->client_list[i];
|
||||
|
||||
/* If ip is not zero and node is good */
|
||||
if (client->ret_ip_port.ip.i != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
if (client->ret_ip_port.ip.uint32 != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
|
||||
if (id_equal(client->client_id, friend->client_id))
|
||||
return 0;
|
||||
|
@ -856,7 +856,7 @@ int route_tofriend(DHT *dht, uint8_t *friend_id, uint8_t *packet, uint32_t lengt
|
|||
client = &friend->client_list[i];
|
||||
|
||||
/* If ip is not zero and node is good */
|
||||
if (client->ret_ip_port.ip.i != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
if (client->ret_ip_port.ip.uint32 != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
if (sendpacket(dht->c->lossless_udp->net->sock, client->ip_port, packet, length) == length)
|
||||
++sent;
|
||||
}
|
||||
|
@ -887,7 +887,7 @@ static int routeone_tofriend(DHT *dht, uint8_t *friend_id, uint8_t *packet, uint
|
|||
client = &friend->client_list[i];
|
||||
|
||||
/* If ip is not zero and node is good. */
|
||||
if (client->ret_ip_port.ip.i != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
if (client->ret_ip_port.ip.uint32 != 0 && !is_timeout(temp_time, client->ret_timestamp, BAD_NODE_TIMEOUT)) {
|
||||
ip_list[n] = client->ip_port;
|
||||
++n;
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ static IP NAT_commonip(IP_Port *ip_portlist, uint16_t len, uint16_t min_num)
|
|||
|
||||
for (i = 0; i < len; ++i) {
|
||||
for (j = 0; j < len; ++j) {
|
||||
if (ip_portlist[i].ip.i == ip_portlist[j].ip.i)
|
||||
if (ip_portlist[i].ip.uint32 == ip_portlist[j].ip.uint32)
|
||||
++numbers[i];
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ static uint16_t NAT_getports(uint16_t *portlist, IP_Port *ip_portlist, uint16_t
|
|||
uint16_t num = 0;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (ip_portlist[i].ip.i == ip.i) {
|
||||
if (ip_portlist[i].ip.uint32 == ip.uint32) {
|
||||
portlist[num] = ntohs(ip_portlist[i].port);
|
||||
++num;
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ static void do_NAT(DHT *dht)
|
|||
|
||||
IP ip = NAT_commonip(ip_list, num, MAX_FRIEND_CLIENTS / 2);
|
||||
|
||||
if (ip.i == 0)
|
||||
if (ip.uint32 == 0)
|
||||
continue;
|
||||
|
||||
uint16_t port_list[MAX_FRIEND_CLIENTS];
|
||||
|
@ -1099,15 +1099,15 @@ static void do_NAT(DHT *dht)
|
|||
*/
|
||||
int add_toping(DHT *dht, uint8_t *client_id, IP_Port ip_port)
|
||||
{
|
||||
if (ip_port.ip.i == 0)
|
||||
if (ip_port.ip.uint32 == 0)
|
||||
return -1;
|
||||
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < MAX_TOPING; ++i) {
|
||||
if (dht->toping[i].ip_port.ip.i == 0) {
|
||||
if (dht->toping[i].ip_port.ip.uint32 == 0) {
|
||||
memcpy(dht->toping[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||
dht->toping[i].ip_port.ip.i = ip_port.ip.i;
|
||||
dht->toping[i].ip_port.ip.uint32 = ip_port.ip.uint32;
|
||||
dht->toping[i].ip_port.port = ip_port.port;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ int add_toping(DHT *dht, uint8_t *client_id, IP_Port ip_port)
|
|||
for (i = 0; i < MAX_TOPING; ++i) {
|
||||
if (id_closest(dht->c->self_public_key, dht->toping[i].client_id, client_id) == 2) {
|
||||
memcpy(dht->toping[i].client_id, client_id, CLIENT_ID_SIZE);
|
||||
dht->toping[i].ip_port.ip.i = ip_port.ip.i;
|
||||
dht->toping[i].ip_port.ip.uint32 = ip_port.ip.uint32;
|
||||
dht->toping[i].ip_port.port = ip_port.port;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1139,11 +1139,11 @@ static void do_toping(DHT *dht)
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < MAX_TOPING; ++i) {
|
||||
if (dht->toping[i].ip_port.ip.i == 0)
|
||||
if (dht->toping[i].ip_port.ip.uint32 == 0)
|
||||
return;
|
||||
|
||||
send_ping_request(dht->ping, dht->c, dht->toping[i].ip_port, dht->toping[i].client_id);
|
||||
dht->toping[i].ip_port.ip.i = 0;
|
||||
dht->toping[i].ip_port.ip.uint32 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,11 +89,10 @@ static IP broadcast_ip(void)
|
|||
{
|
||||
IP ip;
|
||||
#ifdef __linux
|
||||
ip.i = get_broadcast();
|
||||
ip.uint32 = get_broadcast();
|
||||
|
||||
if (ip.i == 0)
|
||||
/* Error occured, but try anyway? */
|
||||
ip.i = ~0;
|
||||
if (ip.uint32 == 0)
|
||||
ip.uint32 = ~0; /* Error occured, but try anyway? */
|
||||
|
||||
#else
|
||||
ip.i = ~0;
|
||||
|
@ -106,19 +105,19 @@ static IP broadcast_ip(void)
|
|||
*/
|
||||
static int LAN_ip(IP ip)
|
||||
{
|
||||
if (ip.c[0] == 127) /* Loopback. */
|
||||
if (ip.uint8[0] == 127) /* Loopback. */
|
||||
return 0;
|
||||
|
||||
if (ip.c[0] == 10) /* 10.0.0.0 to 10.255.255.255 range. */
|
||||
if (ip.uint8[0] == 10) /* 10.0.0.0 to 10.255.255.255 range. */
|
||||
return 0;
|
||||
|
||||
if (ip.c[0] == 172 && ip.c[1] >= 16 && ip.c[1] <= 31) /* 172.16.0.0 to 172.31.255.255 range. */
|
||||
if (ip.uint8[0] == 172 && ip.uint8[1] >= 16 && ip.uint8[1] <= 31) /* 172.16.0.0 to 172.31.255.255 range. */
|
||||
return 0;
|
||||
|
||||
if (ip.c[0] == 192 && ip.c[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
|
||||
if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
|
||||
return 0;
|
||||
|
||||
if (ip.c[0] == 169 && ip.c[1] == 254 && ip.c[2] != 0 && ip.c[2] != 255)/* 169.254.1.0 to 169.254.254.255 range. */
|
||||
if (ip.uint8[0] == 169 && ip.uint8[1] == 254 && ip.uint8[2] != 0 && ip.uint8[2] != 255)/* 169.254.1.0 to 169.254.254.255 range. */
|
||||
return 0;
|
||||
|
||||
return -1;
|
||||
|
|
|
@ -41,7 +41,7 @@ int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port)
|
|||
uint32_t i;
|
||||
|
||||
for (i = 0; i < ludp->connections_length; ++i) {
|
||||
if (ludp->connections[i].ip_port.ip.i == ip_port.ip.i &&
|
||||
if (ludp->connections[i].ip_port.ip.uint32 == ip_port.ip.uint32 &&
|
||||
ludp->connections[i].ip_port.port == ip_port.port &&
|
||||
ludp->connections[i].status > 0)
|
||||
return i;
|
||||
|
|
|
@ -643,7 +643,7 @@ Messenger *initMessenger(void)
|
|||
return NULL;
|
||||
|
||||
IP ip;
|
||||
ip.i = 0;
|
||||
ip.uint32 = 0;
|
||||
m->net = new_networking(ip, PORT);
|
||||
|
||||
if (m->net == NULL) {
|
||||
|
@ -731,7 +731,7 @@ void doFriends(Messenger *m)
|
|||
|
||||
switch (is_cryptoconnected(m->net_crypto, m->friendlist[i].crypt_connection_id)) {
|
||||
case 0:
|
||||
if (friendip.ip.i > 1)
|
||||
if (friendip.ip.uint32 > 1)
|
||||
m->friendlist[i].crypt_connection_id = crypto_connect(m->net_crypto, m->friendlist[i].client_id, friendip);
|
||||
|
||||
break;
|
||||
|
|
|
@ -47,10 +47,10 @@ int send_friendrequest(DHT *dht, uint8_t *public_key, uint32_t nospam_num, uint8
|
|||
|
||||
IP_Port ip_port = DHT_getfriendip(dht, public_key);
|
||||
|
||||
if (ip_port.ip.i == 1)
|
||||
if (ip_port.ip.uint32 == 1)
|
||||
return -1;
|
||||
|
||||
if (ip_port.ip.i != 0) {
|
||||
if (ip_port.ip.uint32 != 0) {
|
||||
if (sendpacket(dht->c->lossless_udp->net->sock, ip_port, packet, len) != -1)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ int crypto_connect(Net_Crypto *c, uint8_t *public_key, IP_Port ip_port)
|
|||
if (id != -1) {
|
||||
IP_Port c_ip = connection_ip(c->lossless_udp, c->crypto_connections[id].number);
|
||||
|
||||
if (c_ip.ip.i == ip_port.ip.i && c_ip.port == ip_port.port)
|
||||
if (c_ip.ip.uint32 == ip_port.ip.uint32 && c_ip.port == ip_port.port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ bool is_pinging(void *ping, IP_Port ipp, uint64_t ping_id) // O(n) TODO: Repl
|
|||
{
|
||||
PING *png = ping;
|
||||
|
||||
if (ipp.ip.i == 0 && ping_id == 0)
|
||||
if (ipp.ip.uint32 == 0 && ping_id == 0)
|
||||
return false;
|
||||
|
||||
size_t i, id;
|
||||
|
@ -107,7 +107,7 @@ bool is_pinging(void *ping, IP_Port ipp, uint64_t ping_id) // O(n) TODO: Repl
|
|||
id = (png->pos_pings + i) % PING_NUM_MAX;
|
||||
|
||||
/* ping_id = 0 means match any id. */
|
||||
if ((ipp_eq(png->pings[id].ipp, ipp) || ipp.ip.i == 0) && (png->pings[id].id == ping_id || ping_id == 0)) {
|
||||
if ((ipp_eq(png->pings[id].ipp, ipp) || ipp.ip.uint32 == 0) && (png->pings[id].id == ping_id || ping_id == 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ uint64_t random_64b()
|
|||
|
||||
bool ipp_eq(IP_Port a, IP_Port b)
|
||||
{
|
||||
return (a.ip.i == b.ip.i) && (a.port == b.port);
|
||||
return (a.ip.uint32 == b.ip.uint32) && (a.port == b.port);
|
||||
}
|
||||
|
||||
bool id_eq(uint8_t *dest, uint8_t *src)
|
||||
|
|
Loading…
Reference in New Issue
Block a user