diff options
author | irungentoo <irungentoo@gmail.com> | 2015-04-22 09:45:33 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-04-22 09:45:33 -0400 |
commit | fc549805c1abfeac3d73f88aa95c1f58dc5ef499 (patch) | |
tree | 1b5daedeebd24dec928256a08bf0e62a1cb4a1e7 /toxcore/TCP_connection.c | |
parent | 390f94bfd54995106c53d8fd0bea67ce9dce8176 (diff) |
Fixed a case where the tcp_data_callback would get called when the
connection only worked 1 way.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r-- | toxcore/TCP_connection.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 26b35a92..d4c1b7c1 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -921,11 +921,13 @@ static int tcp_oob_callback(void *object, const uint8_t *public_key, const uint8 | |||
921 | /* TODO: optimize */ | 921 | /* TODO: optimize */ |
922 | int connections_number = find_tcp_connection_to(tcp_c, public_key); | 922 | int connections_number = find_tcp_connection_to(tcp_c, public_key); |
923 | 923 | ||
924 | if (connections_number == -1) { | 924 | TCP_Connection_to *con_to = get_connection(tcp_c, connections_number); |
925 | |||
926 | if (con_to && tcp_connection_in_conn(con_to, tcp_connections_number)) { | ||
927 | return tcp_data_callback(object, connections_number, 0, data, length); | ||
928 | } else { | ||
925 | if (tcp_c->tcp_oob_callback) | 929 | if (tcp_c->tcp_oob_callback) |
926 | tcp_c->tcp_oob_callback(tcp_c->tcp_oob_callback_object, public_key, tcp_connections_number, data, length); | 930 | tcp_c->tcp_oob_callback(tcp_c->tcp_oob_callback_object, public_key, tcp_connections_number, data, length); |
927 | } else { | ||
928 | return tcp_data_callback(object, connections_number, 0, data, length); | ||
929 | } | 931 | } |
930 | 932 | ||
931 | return 0; | 933 | return 0; |