From 32ed095d7271a311a89d1430610e3adb4568ce2c Mon Sep 17 00:00:00 2001 From: irungentoo Date: Mon, 14 Jul 2014 18:20:17 -0400 Subject: [PATCH] Change connection status before handling data packets. --- toxcore/net_crypto.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 3751d0e2..c44d09c4 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -1106,6 +1106,14 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i return -1; } + if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { + clear_temp_packet(c, crypt_connection_id); + conn->status = CRYPTO_CONN_ESTABLISHED; + + if (conn->connection_status_callback) + conn->connection_status_callback(conn->connection_status_callback_object, conn->connection_status_callback_id, 1); + } + if (real_data[0] == PACKET_ID_REQUEST) { int requested = handle_request_packet(&conn->send_array, real_data, real_length); @@ -1148,14 +1156,6 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i return -1; } - if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { - clear_temp_packet(c, crypt_connection_id); - conn->status = CRYPTO_CONN_ESTABLISHED; - - if (conn->connection_status_callback) - conn->connection_status_callback(conn->connection_status_callback_object, conn->connection_status_callback_id, 1); - } - return 0; }