Fixed useless inbound connection not timing out.

This commit is contained in:
irungentoo 2013-07-14 15:22:49 -04:00
parent 41d31e9802
commit f3dfeb607b
2 changed files with 5 additions and 1 deletions

View File

@ -198,7 +198,8 @@ int new_inconnection(IP_Port ip_port)
connections[i].SYNC_rate = SYNC_RATE; connections[i].SYNC_rate = SYNC_RATE;
connections[i].data_rate = DATA_SYNC_RATE; connections[i].data_rate = DATA_SYNC_RATE;
connections[i].last_recv = current_time(); 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; connections[i].send_counter = 127;
return i; return i;
} }

View File

@ -660,6 +660,9 @@ static void receive_crypto()
{ {
increment_nonce(crypto_connections[i].recv_nonce); increment_nonce(crypto_connections[i].recv_nonce);
crypto_connections[i].status = 3; 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 else
{ {