diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 6728231d..c8d69494 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -1222,14 +1222,14 @@ void doFriends(Messenger *m) set_friend_status(m, i, FRIEND_CONFIRMED); } - break; - } + if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) { + /* If we stopped recieving ping packets, kill it. */ + crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id); + m->friendlist[i].crypt_connection_id = -1; + set_friend_status(m, i, FRIEND_CONFIRMED); + } - if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) { - /* If we stopped recieving ping packets, kill it. */ - crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id); - m->friendlist[i].crypt_connection_id = -1; - set_friend_status(m, i, FRIEND_CONFIRMED); + break; } } }