diff options
author | irungentoo <irungentoo@gmail.com> | 2014-03-07 16:05:08 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-03-07 16:05:08 -0500 |
commit | d058a59ccf7179a883813a5acba14569be20bf12 (patch) | |
tree | 820c97d080fbb61cc691bdc3fd46dcf553e95553 /toxcore | |
parent | b451565f17a0423b4910d4c96df4f78816f02e60 (diff) |
Fixed some possible ways connections could linger indefinitely without being killed.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/Lossless_UDP.c | 3 | ||||
-rw-r--r-- | toxcore/Messenger.c | 2 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 4 |
3 files changed, 9 insertions, 0 deletions
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index 01f9ccc2..c0db8a10 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c | |||
@@ -1083,6 +1083,9 @@ static void do_new(Lossless_UDP *ludp) | |||
1083 | 1083 | ||
1084 | if (tmp->status != LUDP_NO_CONNECTION && tmp->killat < temp_time) | 1084 | if (tmp->status != LUDP_NO_CONNECTION && tmp->killat < temp_time) |
1085 | tmp->status = LUDP_TIMED_OUT; | 1085 | tmp->status = LUDP_TIMED_OUT; |
1086 | |||
1087 | if (tmp->inbound == LUDP_CONNECTION_INBOUND && tmp->status == LUDP_TIMED_OUT) | ||
1088 | kill_connection(ludp, tmp_i); | ||
1086 | } | 1089 | } |
1087 | } | 1090 | } |
1088 | 1091 | ||
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 50f4851b..2772d6d0 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -2140,6 +2140,8 @@ void do_inbound(Messenger *m) | |||
2140 | accept_crypto_inbound(m->net_crypto, inconnection, public_key, secret_nonce, session_key); | 2140 | accept_crypto_inbound(m->net_crypto, inconnection, public_key, secret_nonce, session_key); |
2141 | 2141 | ||
2142 | set_friend_status(m, friend_id, FRIEND_CONFIRMED); | 2142 | set_friend_status(m, friend_id, FRIEND_CONFIRMED); |
2143 | } else { | ||
2144 | kill_connection(m->net_crypto->lossless_udp, inconnection); | ||
2143 | } | 2145 | } |
2144 | } | 2146 | } |
2145 | } | 2147 | } |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 16a6784f..d2dbc90f 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -573,7 +573,11 @@ int crypto_inbound(Net_Crypto *c, uint8_t *public_key, uint8_t *secret_nonce, ui | |||
573 | 573 | ||
574 | if (handle_cryptohandshake(c, public_key, secret_nonce, session_key, temp_data, len)) { | 574 | if (handle_cryptohandshake(c, public_key, secret_nonce, session_key, temp_data, len)) { |
575 | return incoming_con; | 575 | return incoming_con; |
576 | } else { | ||
577 | kill_connection(c->lossless_udp, incoming_con); | ||
576 | } | 578 | } |
579 | } else { | ||
580 | kill_connection(c->lossless_udp, incoming_con); | ||
577 | } | 581 | } |
578 | } else { | 582 | } else { |
579 | break; | 583 | break; |