From 8d15ccc3471a7ea7216b659b7ba04f1ed4e6c8aa Mon Sep 17 00:00:00 2001 From: irungentoo Date: Mon, 21 Jul 2014 12:58:28 -0400 Subject: Don't set connection to established if packet is kill packet. Removed now useless defines in network.h --- toxcore/net_crypto.c | 8 +++++--- toxcore/network.h | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'toxcore') 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 */ -- cgit v1.2.3