diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index ac2359ee..5387065c 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 return -1; } + if (real_data[0] == PACKET_ID_KILL) { + conn->killed = 1; + return 0; + } + if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { clear_temp_packet(c, crypt_connection_id); conn->status = CRYPTO_CONN_ESTABLISHED; @@ -1112,9 +1117,6 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i } set_buffer_end(&conn->recv_array, num); - } else if (real_data[0] == PACKET_ID_KILL) { - conn->killed = 1; - return 0; } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { Packet_Data dt; dt.time = current_time_monotonic(); diff --git a/toxcore/network.h b/toxcore/network.h index b902a487..da175309 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -99,9 +99,6 @@ typedef int sock_t; #define NET_PACKET_GET_NODES 2 /* Get nodes request packet ID. */ #define NET_PACKET_SEND_NODES 3 /* Send nodes response packet ID for IPv4 addresses. */ #define NET_PACKET_SEND_NODES_IPV6 4 /* Send nodes response packet ID for other addresses. */ -#define NET_PACKET_HANDSHAKE 16 /* Handshake packet ID. */ -#define NET_PACKET_SYNC 17 /* SYNC packet ID. */ -#define NET_PACKET_DATA 18 /* Data packet ID. */ #define NET_PACKET_COOKIE_REQUEST 24 /* Cookie request packet */ #define NET_PACKET_COOKIE_RESPONSE 25 /* Cookie response packet */ #define NET_PACKET_CRYPTO_HS 26 /* Crypto handshake packet */