mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Code cleanups.
This commit is contained in:
parent
3c7888d752
commit
fd56762a1b
|
@ -122,7 +122,7 @@ void new_nonce(uint8_t *nonce);
|
|||
|
||||
#define CRYPTO_PACKET_FRIEND_REQ 32 /* Friend request crypto packet ID. */
|
||||
#define CRYPTO_PACKET_HARDENING 48 /* Hardening crypto packet ID. */
|
||||
#define CRYPTO_PACKET_FAKEID 156
|
||||
#define CRYPTO_PACKET_DHTPK 156
|
||||
#define CRYPTO_PACKET_NAT_PING 254 /* NAT ping crypto packet ID. */
|
||||
|
||||
/* Create a request to peer.
|
||||
|
|
|
@ -858,7 +858,7 @@ static int send_dht_dhtpk(const Onion_Client *onion_c, int friend_num, const uin
|
|||
|
||||
uint8_t packet[MAX_CRYPTO_REQUEST_SIZE];
|
||||
len = create_request(onion_c->dht->self_public_key, onion_c->dht->self_secret_key, packet,
|
||||
onion_c->friends_list[friend_num].dht_public_key, temp, sizeof(temp), CRYPTO_PACKET_FAKEID);
|
||||
onion_c->friends_list[friend_num].dht_public_key, temp, sizeof(temp), CRYPTO_PACKET_DHTPK);
|
||||
|
||||
if (len == -1)
|
||||
return -1;
|
||||
|
@ -1396,7 +1396,7 @@ Onion_Client *new_onion_client(Net_Crypto *c)
|
|||
networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, &handle_announce_response, onion_c);
|
||||
networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, &handle_data_response, onion_c);
|
||||
oniondata_registerhandler(onion_c, ONION_DATA_DHTPK, &handle_dhtpk_announce, onion_c);
|
||||
cryptopacket_registerhandler(onion_c->dht, CRYPTO_PACKET_FAKEID, &handle_dht_dhtpk, onion_c);
|
||||
cryptopacket_registerhandler(onion_c->dht, CRYPTO_PACKET_DHTPK, &handle_dht_dhtpk, onion_c);
|
||||
tcp_onion_response_handler(onion_c->c, &handle_tcp_onion, onion_c);
|
||||
|
||||
return onion_c;
|
||||
|
@ -1412,7 +1412,7 @@ void kill_onion_client(Onion_Client *onion_c)
|
|||
networking_registerhandler(onion_c->net, NET_PACKET_ANNOUNCE_RESPONSE, NULL, NULL);
|
||||
networking_registerhandler(onion_c->net, NET_PACKET_ONION_DATA_RESPONSE, NULL, NULL);
|
||||
oniondata_registerhandler(onion_c, ONION_DATA_DHTPK, NULL, NULL);
|
||||
cryptopacket_registerhandler(onion_c->dht, CRYPTO_PACKET_FAKEID, NULL, NULL);
|
||||
cryptopacket_registerhandler(onion_c->dht, CRYPTO_PACKET_DHTPK, NULL, NULL);
|
||||
tcp_onion_response_handler(onion_c->c, NULL, NULL);
|
||||
memset(onion_c, 0, sizeof(Onion_Client));
|
||||
free(onion_c);
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
/* Onion data packet ids. */
|
||||
#define ONION_DATA_FRIEND_REQ CRYPTO_PACKET_FRIEND_REQ
|
||||
#define ONION_DATA_DHTPK CRYPTO_PACKET_FAKEID
|
||||
#define ONION_DATA_DHTPK CRYPTO_PACKET_DHTPK
|
||||
|
||||
typedef struct {
|
||||
uint8_t public_key[crypto_box_PUBLICKEYBYTES];
|
||||
|
|
Loading…
Reference in New Issue
Block a user