From 6dcd90a11695f34728c928570b2168341c3c9dcc Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 27 Jul 2014 10:22:29 -0400 Subject: [PATCH] Only send kill packet when killing established connection. --- toxcore/net_crypto.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index e67251f6..c3ae3663 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -2475,7 +2475,9 @@ int crypto_kill(Net_Crypto *c, int crypt_connection_id) if (conn == 0) return -1; - send_kill_packet(c, crypt_connection_id); + if (conn->status == CRYPTO_CONN_ESTABLISHED) + send_kill_packet(c, crypt_connection_id); + disconnect_peer_tcp(c, crypt_connection_id); bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); return wipe_crypto_connection(c, crypt_connection_id);