* Applied the fix for TCP ports aging out reserved TCP ports properly to DRBD->get_next_resource().

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent ea95d26cc5
commit ae55ca9187
  1. 34
      Anvil/Tools/DRBD.pm

@ -2060,7 +2060,7 @@ ORDER BY
's3:variable_uuid' => $variable_uuid, 's3:variable_uuid' => $variable_uuid,
}}); }});
if (($variable_value) && ($variable_value !~ /^\d+$/)) if (($variable_value) && (($variable_value !~ /^\d+$/) or (time > $variable_value)))
{ {
# Bad value, clear it. # Bad value, clear it.
$variable_uuid = $anvil->Database->insert_or_update_variables({ $variable_uuid = $anvil->Database->insert_or_update_variables({
@ -2069,7 +2069,11 @@ ORDER BY
variable_value => "0", variable_value => "0",
update_value_only => "", update_value_only => "",
}); });
$variable_value = 0; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }});
# Clear the variable UUID for the next step.
$variable_uuid = "";
$variable_value = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
variable_uuid => $variable_uuid, variable_uuid => $variable_uuid,
variable_value => $variable_value variable_value => $variable_value
@ -2078,29 +2082,9 @@ ORDER BY
if ($variable_uuid) if ($variable_uuid)
{ {
my $now_time = time; $check_port++;
my $age = $now_time - $variable_value; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_port => $check_port }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { next;
age => $age,
now_time => $now_time }});
if (($variable_value) && ($now_time > $variable_value))
{
# This is being held, move on.
$check_port++;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_port => $check_port }});
next;
}
else
{
# Either the hold is stale or invalid, delete it.
$variable_uuid = $anvil->Database->insert_or_update_variables({
debug => $debug,
variable_uuid => $variable_uuid,
variable_value => "0",
update_value_only => "",
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable_uuid => $variable_uuid }});
}
} }
# To prevent a race condition, put a one minute hold on this port number. # To prevent a race condition, put a one minute hold on this port number.

Loading…
Cancel
Save