Skip to content

Commit

Permalink
Fixed some possible ways connections could linger indefinitely withou…
Browse files Browse the repository at this point in the history
…t being killed.
  • Loading branch information
irungentoo committed Mar 7, 2014
1 parent b451565 commit d058a59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions toxcore/Lossless_UDP.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,9 @@ static void do_new(Lossless_UDP *ludp)

if (tmp->status != LUDP_NO_CONNECTION && tmp->killat < temp_time)
tmp->status = LUDP_TIMED_OUT;

if (tmp->inbound == LUDP_CONNECTION_INBOUND && tmp->status == LUDP_TIMED_OUT)
kill_connection(ludp, tmp_i);
}
}

Expand Down
2 changes: 2 additions & 0 deletions toxcore/Messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,8 @@ void do_inbound(Messenger *m)
accept_crypto_inbound(m->net_crypto, inconnection, public_key, secret_nonce, session_key);

set_friend_status(m, friend_id, FRIEND_CONFIRMED);
} else {
kill_connection(m->net_crypto->lossless_udp, inconnection);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions toxcore/net_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,11 @@ int crypto_inbound(Net_Crypto *c, uint8_t *public_key, uint8_t *secret_nonce, ui

if (handle_cryptohandshake(c, public_key, secret_nonce, session_key, temp_data, len)) {
return incoming_con;
} else {
kill_connection(c->lossless_udp, incoming_con);
}
} else {
kill_connection(c->lossless_udp, incoming_con);
}
} else {
break;
Expand Down

0 comments on commit d058a59

Please sign in to comment.