summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-07-27 10:22:29 -0400
committerirungentoo <irungentoo@gmail.com>2014-07-27 10:22:29 -0400
commit6dcd90a11695f34728c928570b2168341c3c9dcc (patch)
tree44527c4f067ff2096103d53c0cf126f4bc58dec6 /toxcore
parentab4673e87340b24c58ceaf82e2d41b5a3bee695f (diff)
Only send kill packet when killing established connection.
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/net_crypto.c4
1 files changed, 3 insertions, 1 deletions
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)
2475 if (conn == 0) 2475 if (conn == 0)
2476 return -1; 2476 return -1;
2477 2477
2478 send_kill_packet(c, crypt_connection_id); 2478 if (conn->status == CRYPTO_CONN_ESTABLISHED)
2479 send_kill_packet(c, crypt_connection_id);
2480
2479 disconnect_peer_tcp(c, crypt_connection_id); 2481 disconnect_peer_tcp(c, crypt_connection_id);
2480 bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); 2482 bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id);
2481 return wipe_crypto_connection(c, crypt_connection_id); 2483 return wipe_crypto_connection(c, crypt_connection_id);