From f3dfeb607b31d14d1e93217b993848a1bb789b1d Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 14 Jul 2013 15:22:49 -0400 Subject: [PATCH] Fixed useless inbound connection not timing out. --- core/Lossless_UDP.c | 3 ++- core/net_crypto.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c index 9d31a53b..1f123eda 100644 --- a/core/Lossless_UDP.c +++ b/core/Lossless_UDP.c @@ -198,7 +198,8 @@ int new_inconnection(IP_Port ip_port) connections[i].SYNC_rate = SYNC_RATE; connections[i].data_rate = DATA_SYNC_RATE; connections[i].last_recv = current_time(); - connections[i].killat = ~0; + //if this connection isn't handled within 5 seconds, kill it + connections[i].killat = current_time() + 1000000UL*CONNEXION_TIMEOUT; connections[i].send_counter = 127; return i; } diff --git a/core/net_crypto.c b/core/net_crypto.c index 2af5239b..faeb6be6 100644 --- a/core/net_crypto.c +++ b/core/net_crypto.c @@ -660,6 +660,9 @@ static void receive_crypto() { increment_nonce(crypto_connections[i].recv_nonce); crypto_connections[i].status = 3; + + //connection is accepted so we disable the auto kill by setting it to about 1 month from now. + kill_connection_in(crypto_connections[i].number, 3000000); } else {