summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-07-14 18:20:17 -0400
committerirungentoo <irungentoo@gmail.com>2014-07-14 18:20:17 -0400
commit32ed095d7271a311a89d1430610e3adb4568ce2c (patch)
treec9a6001250e0949dfe360720b501fbae0e97da19 /toxcore
parent2ea634ece28b11ef204b3669a42dde30c5e24ffe (diff)
Change connection status before handling data packets.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/net_crypto.c16
1 files 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
1106 return -1; 1106 return -1;
1107 } 1107 }
1108 1108
1109 if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) {
1110 clear_temp_packet(c, crypt_connection_id);
1111 conn->status = CRYPTO_CONN_ESTABLISHED;
1112
1113 if (conn->connection_status_callback)
1114 conn->connection_status_callback(conn->connection_status_callback_object, conn->connection_status_callback_id, 1);
1115 }
1116
1109 if (real_data[0] == PACKET_ID_REQUEST) { 1117 if (real_data[0] == PACKET_ID_REQUEST) {
1110 int requested = handle_request_packet(&conn->send_array, real_data, real_length); 1118 int requested = handle_request_packet(&conn->send_array, real_data, real_length);
1111 1119
@@ -1148,14 +1156,6 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i
1148 return -1; 1156 return -1;
1149 } 1157 }
1150 1158
1151 if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) {
1152 clear_temp_packet(c, crypt_connection_id);
1153 conn->status = CRYPTO_CONN_ESTABLISHED;
1154
1155 if (conn->connection_status_callback)
1156 conn->connection_status_callback(conn->connection_status_callback_object, conn->connection_status_callback_id, 1);
1157 }
1158
1159 return 0; 1159 return 0;
1160} 1160}
1161 1161