summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotsecure <notsecure@marek.ca>2014-05-20 09:21:26 -0400
committernotsecure <notsecure@marek.ca>2014-05-20 09:21:26 -0400
commit6eae3d5ad7cb984314c6ff2b12756bbc4324af54 (patch)
tree24a0aa8739ed511817107c98b824b1b2e82c8d62
parentb034be4162ac232992d625413369d6305c2a5dd7 (diff)
fixed some mistakes
-rw-r--r--toxcore/TCP_server.c6
-rw-r--r--toxcore/list.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c
index fe912f94..a47f74e2 100644
--- a/toxcore/TCP_server.c
+++ b/toxcore/TCP_server.c
@@ -140,6 +140,9 @@ static int add_accepted(TCP_Server *TCP_server, TCP_Secure_Connection *con)
140 return -1; 140 return -1;
141 } 141 }
142 142
143 if (!list_add(&TCP_server->accepted_key_list, con->public_key, index))
144 return -1;
145
143 memcpy(&TCP_server->accepted_connection_array[index], con, sizeof(TCP_Secure_Connection)); 146 memcpy(&TCP_server->accepted_connection_array[index], con, sizeof(TCP_Secure_Connection));
144 TCP_server->accepted_connection_array[index].status = TCP_STATUS_CONFIRMED; 147 TCP_server->accepted_connection_array[index].status = TCP_STATUS_CONFIRMED;
145 ++TCP_server->num_accepted_connections; 148 ++TCP_server->num_accepted_connections;
@@ -147,9 +150,6 @@ static int add_accepted(TCP_Server *TCP_server, TCP_Secure_Connection *con)
147 TCP_server->accepted_connection_array[index].last_pinged = unix_time(); 150 TCP_server->accepted_connection_array[index].last_pinged = unix_time();
148 TCP_server->accepted_connection_array[index].ping_id = 0; 151 TCP_server->accepted_connection_array[index].ping_id = 0;
149 152
150 if (!list_add(&TCP_server->accepted_key_list, con->public_key, index))
151 return -1;
152
153 return index; 153 return index;
154} 154}
155 155
diff --git a/toxcore/list.c b/toxcore/list.c
index 2b21eec8..2904d15b 100644
--- a/toxcore/list.c
+++ b/toxcore/list.c
@@ -189,6 +189,8 @@ int list_remove(LIST *list, void *data, int id)
189 return 0; 189 return 0;
190 } 190 }
191 191
192 list->n--;
193
192 memmove(list->data + i * list->size, list->data + (i + 1) * list->size, (list->n - i) * list->size); 194 memmove(list->data + i * list->size, list->data + (i + 1) * list->size, (list->n - i) * list->size);
193 memmove(&list->ids[i], &list->ids[i + 1], (list->n - i) * sizeof(int)); 195 memmove(&list->ids[i], &list->ids[i + 1], (list->n - i) * sizeof(int));
194 196