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; }