diff options
author | Gregory Mullen (grayhatter) <greg@grayhatter.com> | 2016-08-22 14:44:58 -0700 |
---|---|---|
committer | Gregory Mullen (grayhatter) <greg@grayhatter.com> | 2016-09-06 02:22:04 -0700 |
commit | aad1e0ad3f96786e0fb10d8dd144e5e6ebe93258 (patch) | |
tree | 963477c57148626140286ac278369ef3af60811f /toxcore/DHT.c | |
parent | e7d3a1a665d1204d15b00fdbe6716b43d8ef3b4a (diff) |
Make friend requests stateless
Messenger is slightly twisty when it comes to sending connection status
callbacks It will very likely need at the very least a partial refactor to
clean it up a bit. Toxcore shouldn't need void *userdata as deep as is
currently does.
(amend 1) Because of the nature of toxcore connection callbacks, I decided to
change this commit from statelessness for connections changes to statelessness
for friend requests. It's simpler this was and doesn't include doing anything
foolish in the time between commits.
group fixup because grayhatter doesn't want to do it
"arguably correct" is not how you write security sensitive code
Clear a compiler warning about types within a function.
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r-- | toxcore/DHT.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 2fd18c49..ac94a36e 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -1944,7 +1944,7 @@ static int send_NATping(DHT *dht, const uint8_t *public_key, uint64_t ping_id, u | |||
1944 | 1944 | ||
1945 | /* Handle a received ping request for. */ | 1945 | /* Handle a received ping request for. */ |
1946 | static int handle_NATping(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, | 1946 | static int handle_NATping(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, |
1947 | uint16_t length) | 1947 | uint16_t length, void *userdata) |
1948 | { | 1948 | { |
1949 | if (length != sizeof(uint64_t) + 1) { | 1949 | if (length != sizeof(uint64_t) + 1) { |
1950 | return 1; | 1950 | return 1; |
@@ -2243,7 +2243,7 @@ static uint32_t have_nodes_closelist(DHT *dht, Node_format *nodes, uint16_t num) | |||
2243 | 2243 | ||
2244 | /* Handle a received hardening packet */ | 2244 | /* Handle a received hardening packet */ |
2245 | static int handle_hardening(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, | 2245 | static int handle_hardening(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, |
2246 | uint16_t length) | 2246 | uint16_t length, void *userdata) |
2247 | { | 2247 | { |
2248 | DHT *dht = object; | 2248 | DHT *dht = object; |
2249 | 2249 | ||
@@ -2503,7 +2503,7 @@ static int cryptopacket_handle(void *object, IP_Port source, const uint8_t *pack | |||
2503 | } | 2503 | } |
2504 | 2504 | ||
2505 | return dht->cryptopackethandlers[number].function(dht->cryptopackethandlers[number].object, source, public_key, | 2505 | return dht->cryptopackethandlers[number].function(dht->cryptopackethandlers[number].object, source, public_key, |
2506 | data, len); | 2506 | data, len, userdata); |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | /* If request is not for us, try routing it. */ | 2509 | /* If request is not for us, try routing it. */ |