Subject: | set_data_fn cannot be executed successfully |
Date: | Sat, 26 Apr 2014 18:37:21 +0800 |
To: | bug-Gearman-XS [...] rt.cpan.org |
From: | mz <zm_mail [...] icloud.com> |
Hi,
set_data_fn cannot be executed successfully in Gearmand 1.1.2.
For example:
in reverse_client_cb.pl
...
$client->set_created_fn(\&created_cb);
$client->set_data_fn(\&data_cb);
$client->set_complete_fn(\&completed_cb);
$client->set_fail_fn(\&fail_cb);
$client->set_status_fn(\&status_cb);
$ret= $client->run_tasks();
if ($ret != GEARMAN_SUCCESS)
{
printf(STDERR "%s\n", $client->error());
exit(1);
}
exit;
sub created_cb {
my ($task) = @_;
printf("Created: %s\n", $task->job_handle());
return GEARMAN_SUCCESS;
}
sub data_cb {
my ($task) = @_;
printf("Data: %s %s\n", $task->job_handle(), $task->data());
return GEARMAN_SUCCESS;
}
…
The data_cb() cannot be call_backed when worker executes send_data().
If I modified "$client->set_data_fn(\&data_cb);” to "$client->set_data_fn(&data_cb);” , The data_cb() will be call_backed, but $task is wrong.
Sincerely,
Hansen