From aae9fae257bb3948a1c5d51f939b25516b54c3ff Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 28 Sep 2013 20:50:54 -0400 Subject: [PATCH] Fixed possible problem. --- toxcore/net_crypto.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index b82a1e6d..9a840d11 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -508,8 +508,7 @@ int crypto_inbound(Net_Crypto *c, uint8_t *public_key, uint8_t *secret_nonce, ui int incoming_con = incoming_connection(c->lossless_udp, 1); if (incoming_con != -1) { - if (is_connected(c->lossless_udp, incoming_con) == 4 - || is_connected(c->lossless_udp, incoming_con) == 0) { + if (is_connected(c->lossless_udp, incoming_con) == 4) { kill_connection(c->lossless_udp, incoming_con); continue; } @@ -671,6 +670,9 @@ static void receive_crypto(Net_Crypto *c) uint64_t temp_time = unix_time(); for (i = 0; i < c->crypto_connections_length; ++i) { + if (c->crypto_connections[i].status == CONN_NO_CONNECTION) + continue; + if (c->crypto_connections[i].status == CONN_HANDSHAKE_SENT) { uint8_t temp_data[MAX_DATA_SIZE]; uint8_t secret_nonce[crypto_box_NONCEBYTES];