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/TCP_connection.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/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 922bf0df..623aeb4f 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -375,7 +375,8 @@ void set_packet_tcp_connection_callback(TCP_Connections *tcp_c, int (*tcp_data_c | |||
375 | /* Set the callback for TCP onion packets. | 375 | /* Set the callback for TCP onion packets. |
376 | */ | 376 | */ |
377 | void set_oob_packet_tcp_connection_callback(TCP_Connections *tcp_c, int (*tcp_oob_callback)(void *object, | 377 | void set_oob_packet_tcp_connection_callback(TCP_Connections *tcp_c, int (*tcp_oob_callback)(void *object, |
378 | const uint8_t *public_key, unsigned int tcp_connections_number, const uint8_t *data, uint16_t length), void *object) | 378 | const uint8_t *public_key, unsigned int tcp_connections_number, const uint8_t *data, uint16_t length, void *userdata), |
379 | void *object) | ||
379 | { | 380 | { |
380 | tcp_c->tcp_oob_callback = tcp_oob_callback; | 381 | tcp_c->tcp_oob_callback = tcp_oob_callback; |
381 | tcp_c->tcp_oob_callback_object = object; | 382 | tcp_c->tcp_oob_callback_object = object; |
@@ -985,7 +986,7 @@ static int tcp_oob_callback(void *object, const uint8_t *public_key, const uint8 | |||
985 | } | 986 | } |
986 | 987 | ||
987 | if (tcp_c->tcp_oob_callback) { | 988 | if (tcp_c->tcp_oob_callback) { |
988 | tcp_c->tcp_oob_callback(tcp_c->tcp_oob_callback_object, public_key, tcp_connections_number, data, length); | 989 | tcp_c->tcp_oob_callback(tcp_c->tcp_oob_callback_object, public_key, tcp_connections_number, data, length, userdata); |
989 | } | 990 | } |
990 | 991 | ||
991 | return 0; | 992 | return 0; |