mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Check if node can be stored before sorting.
This commit is contained in:
parent
8fa264e770
commit
39700abd86
|
@ -733,15 +733,15 @@ static int replace_all( Client_data *list,
|
|||
if ((ip_port.ip.family != AF_INET) && (ip_port.ip.family != AF_INET6))
|
||||
return 0;
|
||||
|
||||
memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES);
|
||||
qsort(list, length, sizeof(Client_data), cmp_dht_entry);
|
||||
if (store_node_ok(&list[1], public_key, comp_public_key)) {
|
||||
memcpy(cmp_public_key, comp_public_key, crypto_box_PUBLICKEYBYTES);
|
||||
qsort(list, length, sizeof(Client_data), cmp_dht_entry);
|
||||
|
||||
Client_data *client = &list[0];
|
||||
|
||||
if (store_node_ok(client, public_key, comp_public_key)) {
|
||||
IPPTsPng *ipptp_write = NULL;
|
||||
IPPTsPng *ipptp_clear = NULL;
|
||||
|
||||
Client_data *client = &list[0];
|
||||
|
||||
if (ip_port.ip.family == AF_INET) {
|
||||
ipptp_write = &client->assoc4;
|
||||
ipptp_clear = &client->assoc6;
|
||||
|
@ -1375,7 +1375,6 @@ static void divide_by_2(uint8_t *public_key)
|
|||
static void find_midpoint(uint8_t *out, const uint8_t *top, const uint8_t *bot)
|
||||
{
|
||||
unsigned int i;
|
||||
_Bool one = 0;
|
||||
|
||||
for (i = 0; i < crypto_box_PUBLICKEYBYTES; ++i) {
|
||||
out[i] = top[i] ^ bot[i];
|
||||
|
|
Loading…
Reference in New Issue
Block a user