diff options
author | irungentoo <irungentoo@gmail.com> | 2015-08-06 11:50:25 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-08-06 11:50:25 -0400 |
commit | 4d28630d4938f4a5a0f9db5f58650036a45f2ddc (patch) | |
tree | 0f1cdcb0b70c259b1f3cb4fa82dcb9916dda282a /toxcore | |
parent | 540db7ec37c4e3d9a2f5ff76791e06727d4ff097 (diff) |
client_id -> public_key
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/DHT.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 87b282ce..467fff22 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -1163,10 +1163,10 @@ static int handle_sendnodes_ipv6(void *object, IP_Port source, const uint8_t *pa | |||
1163 | /*----------------------------------------------------------------------------------*/ | 1163 | /*----------------------------------------------------------------------------------*/ |
1164 | /*------------------------END of packet handling functions--------------------------*/ | 1164 | /*------------------------END of packet handling functions--------------------------*/ |
1165 | 1165 | ||
1166 | int DHT_addfriend(DHT *dht, const uint8_t *client_id, void (*ip_callback)(void *data, int32_t number, IP_Port), | 1166 | int DHT_addfriend(DHT *dht, const uint8_t *public_key, void (*ip_callback)(void *data, int32_t number, IP_Port), |
1167 | void *data, int32_t number, uint16_t *lock_count) | 1167 | void *data, int32_t number, uint16_t *lock_count) |
1168 | { | 1168 | { |
1169 | int friend_num = friend_number(dht, client_id); | 1169 | int friend_num = friend_number(dht, public_key); |
1170 | 1170 | ||
1171 | uint16_t lock_num; | 1171 | uint16_t lock_num; |
1172 | 1172 | ||
@@ -1197,7 +1197,7 @@ int DHT_addfriend(DHT *dht, const uint8_t *client_id, void (*ip_callback)(void * | |||
1197 | dht->friends_list = temp; | 1197 | dht->friends_list = temp; |
1198 | DHT_Friend *friend = &dht->friends_list[dht->num_friends]; | 1198 | DHT_Friend *friend = &dht->friends_list[dht->num_friends]; |
1199 | memset(friend, 0, sizeof(DHT_Friend)); | 1199 | memset(friend, 0, sizeof(DHT_Friend)); |
1200 | memcpy(friend->public_key, client_id, CLIENT_ID_SIZE); | 1200 | memcpy(friend->public_key, public_key, CLIENT_ID_SIZE); |
1201 | 1201 | ||
1202 | friend->nat.NATping_id = random_64b(); | 1202 | friend->nat.NATping_id = random_64b(); |
1203 | ++dht->num_friends; | 1203 | ++dht->num_friends; |
@@ -1219,7 +1219,7 @@ int DHT_addfriend(DHT *dht, const uint8_t *client_id, void (*ip_callback)(void * | |||
1219 | 1219 | ||
1220 | Assoc_close_entries close_entries; | 1220 | Assoc_close_entries close_entries; |
1221 | memset(&close_entries, 0, sizeof(close_entries)); | 1221 | memset(&close_entries, 0, sizeof(close_entries)); |
1222 | close_entries.wanted_id = client_id; | 1222 | close_entries.wanted_id = public_key; |
1223 | close_entries.count_good = MAX_FRIEND_CLIENTS / 2; | 1223 | close_entries.count_good = MAX_FRIEND_CLIENTS / 2; |
1224 | close_entries.count = MAX_FRIEND_CLIENTS; | 1224 | close_entries.count = MAX_FRIEND_CLIENTS; |
1225 | close_entries.result = calloc(MAX_FRIEND_CLIENTS, sizeof(*close_entries.result)); | 1225 | close_entries.result = calloc(MAX_FRIEND_CLIENTS, sizeof(*close_entries.result)); |
@@ -1234,10 +1234,10 @@ int DHT_addfriend(DHT *dht, const uint8_t *client_id, void (*ip_callback)(void * | |||
1234 | Client_data *client = &friend->client_list[0]; | 1234 | Client_data *client = &friend->client_list[0]; |
1235 | 1235 | ||
1236 | if (ipport_isset(&client->assoc4.ip_port)) | 1236 | if (ipport_isset(&client->assoc4.ip_port)) |
1237 | getnodes(dht, client->assoc4.ip_port, client->client_id, friend->client_id, NULL); | 1237 | getnodes(dht, client->assoc4.ip_port, client->public_key, friend->public_key, NULL); |
1238 | 1238 | ||
1239 | if (ipport_isset(&client->assoc6.ip_port)) | 1239 | if (ipport_isset(&client->assoc6.ip_port)) |
1240 | getnodes(dht, client->assoc6.ip_port, client->client_id, friend->client_id, NULL); | 1240 | getnodes(dht, client->assoc6.ip_port, client->public_key, friend->public_key, NULL); |
1241 | } | 1241 | } |
1242 | } | 1242 | } |
1243 | 1243 | ||
@@ -1246,9 +1246,9 @@ int DHT_addfriend(DHT *dht, const uint8_t *client_id, void (*ip_callback)(void * | |||
1246 | return 0; | 1246 | return 0; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | int DHT_delfriend(DHT *dht, const uint8_t *client_id, uint16_t lock_count) | 1249 | int DHT_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count) |
1250 | { | 1250 | { |
1251 | int friend_num = friend_number(dht, client_id); | 1251 | int friend_num = friend_number(dht, public_key); |
1252 | 1252 | ||
1253 | if (friend_num == -1) { | 1253 | if (friend_num == -1) { |
1254 | return -1; | 1254 | return -1; |