From 993554bdf6e45f084f52d0c6f3b6200dc550e11c Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 19 Sep 2013 09:46:55 -0400 Subject: [PATCH] Fixed bug in Lossless UDP. --- toxcore/Lossless_UDP.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index 46b0bed1..0ee9b890 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c @@ -170,6 +170,7 @@ int new_connection(Lossless_UDP *ludp, IP_Port ip_port) memset(connection, 0, sizeof(Connection)); uint32_t handshake_id1 = handshake_id(ludp, ip_port); + uint64_t timeout = CONNEXION_TIMEOUT + rand() % CONNEXION_TIMEOUT; *connection = (Connection) { .ip_port = ip_port, @@ -186,7 +187,7 @@ int new_connection(Lossless_UDP *ludp, IP_Port ip_port) .killat = ~0, .send_counter = 0, /* add randomness to timeout to prevent connections getting stuck in a loop. */ - .timeout = CONNEXION_TIMEOUT + rand() % CONNEXION_TIMEOUT + .timeout = timeout }; return connection_id;