diff options
author | irungentoo <irungentoo@gmail.com> | 2014-07-21 12:58:28 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-07-21 12:58:28 -0400 |
commit | 8d15ccc3471a7ea7216b659b7ba04f1ed4e6c8aa (patch) | |
tree | 4e360002c22879768bbd4fb71d0e80f5b30fbbcc /toxcore | |
parent | b63e4ad88fb93820fb740372f36d74c65b8b7b81 (diff) |
Don't set connection to established if packet is kill packet.
Removed now useless defines in network.h
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/net_crypto.c | 8 | ||||
-rw-r--r-- | toxcore/network.h | 3 |
2 files changed, 5 insertions, 6 deletions
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 | |||
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(); |
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; | |||
99 | #define NET_PACKET_GET_NODES 2 /* Get nodes request packet ID. */ | 99 | #define NET_PACKET_GET_NODES 2 /* Get nodes request packet ID. */ |
100 | #define NET_PACKET_SEND_NODES 3 /* Send nodes response packet ID for IPv4 addresses. */ | 100 | #define NET_PACKET_SEND_NODES 3 /* Send nodes response packet ID for IPv4 addresses. */ |
101 | #define NET_PACKET_SEND_NODES_IPV6 4 /* Send nodes response packet ID for other addresses. */ | 101 | #define NET_PACKET_SEND_NODES_IPV6 4 /* Send nodes response packet ID for other addresses. */ |
102 | #define NET_PACKET_HANDSHAKE 16 /* Handshake packet ID. */ | ||
103 | #define NET_PACKET_SYNC 17 /* SYNC packet ID. */ | ||
104 | #define NET_PACKET_DATA 18 /* Data packet ID. */ | ||
105 | #define NET_PACKET_COOKIE_REQUEST 24 /* Cookie request packet */ | 102 | #define NET_PACKET_COOKIE_REQUEST 24 /* Cookie request packet */ |
106 | #define NET_PACKET_COOKIE_RESPONSE 25 /* Cookie response packet */ | 103 | #define NET_PACKET_COOKIE_RESPONSE 25 /* Cookie response packet */ |
107 | #define NET_PACKET_CRYPTO_HS 26 /* Crypto handshake packet */ | 104 | #define NET_PACKET_CRYPTO_HS 26 /* Crypto handshake packet */ |