fixed some mistakes

This commit is contained in:
notsecure 2014-05-20 09:21:26 -04:00
parent b034be4162
commit 6eae3d5ad7
2 changed files with 5 additions and 3 deletions

View File

@ -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;
}

View File

@ -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));