Skip to content

Commit

Permalink
Amended the logic of the connection retries.
Browse files Browse the repository at this point in the history
In manage.c, in function get_osp_performance_string (..):
  Rebuild the logic of the connection retries for
  osp_connect_with_data (..) and osp_get_performance_ext (..)
  slightly.
  • Loading branch information
jhelmold committed Jul 19, 2021
1 parent 2d13c54 commit 0d06084
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -4018,12 +4018,13 @@ get_osp_performance_string (scanner_t scanner, int start, int end,
key_priv = scanner_key_priv (scanner);

connection_retry = get_scanner_connection_retry ();
connection = osp_connect_with_data (host, port, ca_pub, key_pub, key_priv);
while (connection == NULL && connection_retry > 0)
{
sleep(1);
connection = osp_connect_with_data (host, port,
ca_pub, key_pub, key_priv);
connection_retry--;
sleep(1);
}

free (host);
Expand All @@ -4040,13 +4041,14 @@ get_osp_performance_string (scanner_t scanner, int start, int end,
error = NULL;

connection_retry = get_scanner_connection_retry ();
return_value = 1;
while (return_value > 0 && connection_retry > 0)
return_value = osp_get_performance_ext (connection, opts,
performance_str, &error);
while (return_value != 0 && connection_retry > 0)
{
sleep(1);
return_value = osp_get_performance_ext (connection, opts,
performance_str, &error);
connection_retry--;
sleep(1);
}

if (return_value)
Expand Down

0 comments on commit 0d06084

Please sign in to comment.