mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
fixed some mistakes
This commit is contained in:
parent
b034be4162
commit
6eae3d5ad7
|
@ -140,6 +140,9 @@ static int add_accepted(TCP_Server *TCP_server, TCP_Secure_Connection *con)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!list_add(&TCP_server->accepted_key_list, con->public_key, index))
|
||||
return -1;
|
||||
|
||||
memcpy(&TCP_server->accepted_connection_array[index], con, sizeof(TCP_Secure_Connection));
|
||||
TCP_server->accepted_connection_array[index].status = TCP_STATUS_CONFIRMED;
|
||||
++TCP_server->num_accepted_connections;
|
||||
|
@ -147,9 +150,6 @@ static int add_accepted(TCP_Server *TCP_server, TCP_Secure_Connection *con)
|
|||
TCP_server->accepted_connection_array[index].last_pinged = unix_time();
|
||||
TCP_server->accepted_connection_array[index].ping_id = 0;
|
||||
|
||||
if (!list_add(&TCP_server->accepted_key_list, con->public_key, index))
|
||||
return -1;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,8 @@ int list_remove(LIST *list, void *data, int id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
list->n--;
|
||||
|
||||
memmove(list->data + i * list->size, list->data + (i + 1) * list->size, (list->n - i) * list->size);
|
||||
memmove(&list->ids[i], &list->ids[i + 1], (list->n - i) * sizeof(int));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user