Skip to content

Commit

Permalink
Fix Error in Delete Orphans which Caused Process to Occur Out of Sequ…
Browse files Browse the repository at this point in the history
…ence

Remove message callback from PLM Delete_Link and insert ALDB_Callback in Insteon_PLM.

Message callback is called as soon as the message is sent, and then it was again called on receiving the ACK.  Which resulted in at least two instances of Delete Orphans running.

Fix hollie#61
  • Loading branch information
krkeegan committed Feb 8, 2013
1 parent a9d4484 commit a1d856e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/Insteon/AllLinkDatabase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,6 @@ sub delete_link
if ($link_parms{callback})
{
$$self{_success_callback} = $link_parms{callback};
$message->callback($link_parms{callback});
}
$message->interface_data($cmd);
$$self{device}->queue_message($message);
Expand Down
17 changes: 12 additions & 5 deletions lib/Insteon_PLM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,22 @@ sub _parse_data {
{
# clear the active message because we're done
$self->clear_active_message();
my $callback = $pending_message->callback(); #$$self{_mem_callback};
$$self{_mem_callback} = undef;
if ($callback)

my $callback;
if ($self->_aldb->{_success_callback}){
$callback = $self->_aldb->{_success_callback};
$self->_aldb->{_success_callback} = undef;
} elsif ($$self{_mem_callback})
{
$callback = $pending_message->callback(); #$$self{_mem_callback};
$$self{_mem_callback} = undef;
}
if ($callback){
package main;
eval ($callback);
&::print_log("[Insteon_PLM] WARN1: Error encountered during ack callback: " . $@)
if $@ and $main::Debug{insteon} >= 1;
package Insteon_PLM;
package Insteon_PLM;
}
}
}
Expand All @@ -449,7 +456,7 @@ sub _parse_data {
$self->_aldb->health("good");
}
if ($$self{_mem_callback})
{
{
my $callback = $$self{_mem_callback};
$$self{_mem_callback} = undef;
package main;
Expand Down

0 comments on commit a1d856e

Please sign in to comment.