Skip to content

Commit

Permalink
Fix: max attempts for tcp socket connections
Browse files Browse the repository at this point in the history
In case the `open_sock_max_attempts` had a value >3 it had endless attempts instead,
as the counter was only increased to a value of 3. This mechanism was meant to be
used as a log limit, so a connection timeout is not logged more than 3 times.
  • Loading branch information
Kraemii committed Jan 17, 2025
1 parent 77b147b commit 95fb75d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions misc/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -1956,9 +1956,9 @@ open_sock_tcp (struct script_infos *args, unsigned int port, int timeout)
if (log_count < 3)
{
g_message ("open_sock_tcp: %s:%d time-out.", ip_str, port);
log_count++;
kb_item_set_int_with_main_kb_check (kb, buffer, log_count);
}
log_count++;
kb_item_set_int_with_main_kb_check (kb, buffer, log_count);
if ((log_count >= attempts) && (attempts != 0))
{
/* After some unsuccessfully attempts, the port is set to closed to
Expand Down

0 comments on commit 95fb75d

Please sign in to comment.