Skip to content

Commit

Permalink
fix broken retry (RT#122131)
Browse files Browse the repository at this point in the history
remove retry codepath which failed due to fix in commit 108c17d
  • Loading branch information
abraxxa committed Jul 4, 2017
1 parent 108c17d commit b40afdb
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions lib/POE/Component/Client/Ping.pm
Expand Up @@ -224,17 +224,12 @@ sub poco_ping_ping {

DEBUG and warn "ping requested for $address ($tries_left try/tries left)\n";

_do_ping(
$kernel, $heap, $sender, $event, $address, $timeout, $tries_left, 0
);
_do_ping($kernel, $heap, $sender, $event, $address, $timeout, $tries_left);
}


sub _do_ping {
my (
$kernel, $heap, $sender, $event, $address, $timeout, $tries_left,
$is_a_retry
) = @_;
my ($kernel, $heap, $sender, $event, $address, $timeout, $tries_left) = @_;

# No current pings. Open a socket, or setup the existing one.
unless (scalar(keys %{$heap->{ping_by_seq}})) {
Expand Down Expand Up @@ -341,7 +336,6 @@ sub _do_ping {
$event, # PEND_EVENT
$address, # PEND_ADDR ???
$timeout, # PEND_TIMEOUT
$is_a_retry, # PEND_IS_RETRY
];

if ($tries_left and $tries_left > 1) {
Expand Down Expand Up @@ -385,7 +379,6 @@ sub _send_next_packet {
$event, # PEND_EVENT
$address, # PEND_ADDR ???
$timeout, # PEND_TIMEOUT
$is_a_retry, # PEND_IS_RETRY
) = @$ping_info;

# Send the packet. If send() fails, then we bail with an error.
Expand Down Expand Up @@ -420,26 +413,19 @@ sub _send_next_packet {
$kernel->delay( $seq => $timeout );

DEBUG_PBS and warn "recording ping_by_seq($seq)";
if ($is_a_retry) {
# If retries, set the request time to the new/actual request time.
# Inserted by Ralph Schmitt 2009-09-12.
$heap->{ping_by_seq}->{$seq}->[PBS_REQUEST_TIME] = time();
}
else {
$heap->{ping_by_seq}->{$seq} = [
# PBS_POSTBACK
$sender->postback(
$event,
$address, # REQ_ADDRESS
$timeout, # REQ_TIMEOUT
time(), # REQ_TIME
@user_args, # REQ_USER_ARGS
),
"$sender", # PBS_SESSION (stringified to weaken reference)
$address, # PBS_ADDRESS
time() # PBS_REQUEST_TIME
];
}
$heap->{ping_by_seq}->{$seq} = [
# PBS_POSTBACK
$sender->postback(
$event,
$address, # REQ_ADDRESS
$timeout, # REQ_TIMEOUT
time(), # REQ_TIME
@user_args, # REQ_USER_ARGS
),
"$sender", # PBS_SESSION (stringified to weaken reference)
$address, # PBS_ADDRESS
time() # PBS_REQUEST_TIME
];

# Duplicate pings? Forcibly time out the previous one.
if (exists $heap->{addr_to_seq}->{$sender}->{$address}) {
Expand Down Expand Up @@ -675,7 +661,7 @@ sub poco_ping_default {
DEBUG and warn("retrying ping for $address (", $remaining - 1, ")\n");
_do_ping(
$kernel, $heap, $sender, $event, $address, $timeout,
$remaining - 1, 1
$remaining - 1
);
return;
}
Expand Down

0 comments on commit b40afdb

Please sign in to comment.