my $self = shift;
my $hash_param;
+
my $method = shift;
if (ref $method) {
$hash_param = $method;
# block on the xmpp socket until data arrives
$xmpp->process(-1);
$self->session_reap;
+ $self->session_reap while $self->check_post_reap_changes;
}
return $count;
} else {
while(($count = $self->session_reap) == 0 && $self->running) {
+ $self->session_reap while $self->check_post_reap_changes;
# block on the xmpp socket until data arrives
$xmpp->process(-1);
}
}
}
+# returns true if any running requests are marked as complete,
+# but does so without touching the underlying socket (note
+# req->{complete} vs req->complete). We do this so that checking
+# the state of the request does not affect the state of the
+# request. With this, we can see if session_reap caused any state
+# changes that were not accounted for within session_reap.
+sub check_post_reap_changes {
+ my $self = shift;
+ return 1 if grep { $_->{req}->{complete} } @{$self->{running}};
+ return 0;
+}
+
sub session_reap {
my $self = shift;