diff options
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index ac2359ee..e67251f6 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1094,6 +1094,11 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i | |||
1094 | return -1; | 1094 | return -1; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | if (real_data[0] == PACKET_ID_KILL) { | ||
1098 | conn->killed = 1; | ||
1099 | return 0; | ||
1100 | } | ||
1101 | |||
1097 | if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { | 1102 | if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { |
1098 | clear_temp_packet(c, crypt_connection_id); | 1103 | clear_temp_packet(c, crypt_connection_id); |
1099 | conn->status = CRYPTO_CONN_ESTABLISHED; | 1104 | conn->status = CRYPTO_CONN_ESTABLISHED; |
@@ -1112,9 +1117,6 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i | |||
1112 | } | 1117 | } |
1113 | 1118 | ||
1114 | set_buffer_end(&conn->recv_array, num); | 1119 | set_buffer_end(&conn->recv_array, num); |
1115 | } else if (real_data[0] == PACKET_ID_KILL) { | ||
1116 | conn->killed = 1; | ||
1117 | return 0; | ||
1118 | } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { | 1120 | } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { |
1119 | Packet_Data dt; | 1121 | Packet_Data dt; |
1120 | dt.time = current_time_monotonic(); | 1122 | dt.time = current_time_monotonic(); |
@@ -1184,7 +1186,8 @@ static int handle_packet_connection(Net_Crypto *c, int crypt_connection_id, cons | |||
1184 | } | 1186 | } |
1185 | 1187 | ||
1186 | case NET_PACKET_CRYPTO_HS: { | 1188 | case NET_PACKET_CRYPTO_HS: { |
1187 | if (conn->status == CRYPTO_CONN_COOKIE_REQUESTING || conn->status == CRYPTO_CONN_HANDSHAKE_SENT) { | 1189 | if (conn->status == CRYPTO_CONN_COOKIE_REQUESTING || conn->status == CRYPTO_CONN_HANDSHAKE_SENT |
1190 | || conn->status == CRYPTO_CONN_NOT_CONFIRMED) { | ||
1188 | uint8_t peer_real_pk[crypto_box_PUBLICKEYBYTES]; | 1191 | uint8_t peer_real_pk[crypto_box_PUBLICKEYBYTES]; |
1189 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; | 1192 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; |
1190 | uint8_t cookie[COOKIE_LENGTH]; | 1193 | uint8_t cookie[COOKIE_LENGTH]; |