Don't set connection to established if packet is kill packet.

Removed now useless defines in network.h
This commit is contained in:
irungentoo 2014-07-21 12:58:28 -04:00
parent b63e4ad88f
commit 8d15ccc347
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 5 additions and 6 deletions

View File

@ -1094,6 +1094,11 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i
return -1; return -1;
} }
if (real_data[0] == PACKET_ID_KILL) {
conn->killed = 1;
return 0;
}
if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) { if (conn->status == CRYPTO_CONN_NOT_CONFIRMED) {
clear_temp_packet(c, crypt_connection_id); clear_temp_packet(c, crypt_connection_id);
conn->status = CRYPTO_CONN_ESTABLISHED; 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); 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) { } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) {
Packet_Data dt; Packet_Data dt;
dt.time = current_time_monotonic(); dt.time = current_time_monotonic();

View File

@ -99,9 +99,6 @@ typedef int sock_t;
#define NET_PACKET_GET_NODES 2 /* Get nodes request packet ID. */ #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 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_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_REQUEST 24 /* Cookie request packet */
#define NET_PACKET_COOKIE_RESPONSE 25 /* Cookie response packet */ #define NET_PACKET_COOKIE_RESPONSE 25 /* Cookie response packet */
#define NET_PACKET_CRYPTO_HS 26 /* Crypto handshake packet */ #define NET_PACKET_CRYPTO_HS 26 /* Crypto handshake packet */