diff options
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r-- | toxcore/onion_client.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 851a0ee1..092198f2 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -758,12 +758,13 @@ static int handle_data_response(void *object, IP_Port source, const uint8_t *pac | |||
758 | } | 758 | } |
759 | 759 | ||
760 | return onion_c->Onion_Data_Handlers[plain[0]].function(onion_c->Onion_Data_Handlers[plain[0]].object, temp_plain, plain, | 760 | return onion_c->Onion_Data_Handlers[plain[0]].function(onion_c->Onion_Data_Handlers[plain[0]].object, temp_plain, plain, |
761 | sizeof(plain)); | 761 | sizeof(plain), userdata); |
762 | } | 762 | } |
763 | 763 | ||
764 | #define DHTPK_DATA_MIN_LENGTH (1 + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES) | 764 | #define DHTPK_DATA_MIN_LENGTH (1 + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES) |
765 | #define DHTPK_DATA_MAX_LENGTH (DHTPK_DATA_MIN_LENGTH + sizeof(Node_format)*MAX_SENT_NODES) | 765 | #define DHTPK_DATA_MAX_LENGTH (DHTPK_DATA_MIN_LENGTH + sizeof(Node_format)*MAX_SENT_NODES) |
766 | static int handle_dhtpk_announce(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t length) | 766 | static int handle_dhtpk_announce(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t length, |
767 | void *userdata) | ||
767 | { | 768 | { |
768 | Onion_Client *onion_c = object; | 769 | Onion_Client *onion_c = object; |
769 | 770 | ||
@@ -793,7 +794,7 @@ static int handle_dhtpk_announce(void *object, const uint8_t *source_pubkey, con | |||
793 | 794 | ||
794 | if (onion_c->friends_list[friend_num].dht_pk_callback) { | 795 | if (onion_c->friends_list[friend_num].dht_pk_callback) { |
795 | onion_c->friends_list[friend_num].dht_pk_callback(onion_c->friends_list[friend_num].dht_pk_callback_object, | 796 | onion_c->friends_list[friend_num].dht_pk_callback(onion_c->friends_list[friend_num].dht_pk_callback_object, |
796 | onion_c->friends_list[friend_num].dht_pk_callback_number, data + 1 + sizeof(uint64_t)); | 797 | onion_c->friends_list[friend_num].dht_pk_callback_number, data + 1 + sizeof(uint64_t), userdata); |
797 | } | 798 | } |
798 | 799 | ||
799 | onion_set_friend_DHT_pubkey(onion_c, friend_num, data + 1 + sizeof(uint64_t)); | 800 | onion_set_friend_DHT_pubkey(onion_c, friend_num, data + 1 + sizeof(uint64_t)); |
@@ -971,7 +972,7 @@ static int send_dht_dhtpk(const Onion_Client *onion_c, int friend_num, const uin | |||
971 | } | 972 | } |
972 | 973 | ||
973 | static int handle_dht_dhtpk(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, | 974 | static int handle_dht_dhtpk(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, |
974 | uint16_t length) | 975 | uint16_t length, void *userdata) |
975 | { | 976 | { |
976 | Onion_Client *onion_c = object; | 977 | Onion_Client *onion_c = object; |
977 | 978 | ||
@@ -996,7 +997,7 @@ static int handle_dht_dhtpk(void *object, IP_Port source, const uint8_t *source_ | |||
996 | return 1; | 997 | return 1; |
997 | } | 998 | } |
998 | 999 | ||
999 | return handle_dhtpk_announce(onion_c, packet, plain, len); | 1000 | return handle_dhtpk_announce(onion_c, packet, plain, len, userdata); |
1000 | } | 1001 | } |
1001 | /* Send the packets to tell our friends what our DHT public key is. | 1002 | /* Send the packets to tell our friends what our DHT public key is. |
1002 | * | 1003 | * |
@@ -1199,7 +1200,7 @@ int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*tcp_rela | |||
1199 | * return 0 on success. | 1200 | * return 0 on success. |
1200 | */ | 1201 | */ |
1201 | int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, void (*function)(void *data, int32_t number, | 1202 | int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, void (*function)(void *data, int32_t number, |
1202 | const uint8_t *dht_public_key), void *object, uint32_t number) | 1203 | const uint8_t *dht_public_key, void *userdata), void *object, uint32_t number) |
1203 | { | 1204 | { |
1204 | if ((uint32_t)friend_num >= onion_c->num_friends) { | 1205 | if ((uint32_t)friend_num >= onion_c->num_friends) { |
1205 | return -1; | 1206 | return -1; |