* shmid are passed to that function as an osl object. The private_result_data
* pointer is passed as the second argument to \a result_handler.
*
* shmid are passed to that function as an osl object. The private_result_data
* pointer is passed as the second argument to \a result_handler.
*
* command. This function allows to pass such a structure together with a list
* of further arguments (often a list of audio files) to the parent process.
*
* command. This function allows to pass such a structure together with a list
* of further arguments (often a list of audio files) to the parent process.
*
* \sa send_standard_callback_request(), send_callback_request().
*/
int send_option_arg_callback_request(struct osl_object *options,
* \sa send_standard_callback_request(), send_callback_request().
*/
int send_option_arg_callback_request(struct osl_object *options,
- return pmd->action(pmd->table, row, name, pmd->data);
+ ret = pmd->action(pmd->table, row, name, pmd->data);
+ if (ret >= 0)
+ pmd->num_matches++;
+ return ret;
ret = score_delete(aft_row);
if (ret < 0) {
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
ret = score_delete(aft_row);
if (ret < 0) {
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
static void com_select_callback(int fd, const struct osl_object *query)
{
struct para_buffer pb = {
static void com_select_callback(int fd, const struct osl_object *query)
{
struct para_buffer pb = {
query.data = argv[1];
query.size = strlen(argv[1]) + 1;
return send_callback_request(com_select_callback, &query,
query.data = argv[1];
query.size = strlen(argv[1]) + 1;
return send_callback_request(com_select_callback, &query,
st->task.pre_select = signal_pre_select;
st->task.post_select = afs_signal_post_select;
sprintf(st->task.status, "signal task");
st->task.pre_select = signal_pre_select;
st->task.post_select = afs_signal_post_select;
sprintf(st->task.status, "signal task");
- int ret = recv_bin_buffer(server_socket, buf, sizeof(buf) - 1);
+ size_t n;
+ int ret = read_nonblock(server_socket, buf, sizeof(buf) - 1, rfds, &n);
-static void execute_afs_command(int fd, uint32_t expected_cookie)
+/* returns 0 if no data available, 1 else */
+static int execute_afs_command(int fd, fd_set *rfds, uint32_t expected_cookie)
- int ret = recv_bin_buffer(fd, buf, sizeof(buf));
+ size_t n;
+ int ret = read_nonblock(fd, buf, sizeof(buf), rfds, &n);
PARA_NOTICE_LOG("short read (%d bytes, expected %lu)\n",
ret, (long unsigned) sizeof(buf));
PARA_NOTICE_LOG("short read (%d bytes, expected %lu)\n",
ret, (long unsigned) sizeof(buf));
}
query_shmid = *(int *)(buf + sizeof(cookie));
if (query_shmid < 0) {
PARA_WARNING_LOG("received invalid query shmid %d)\n",
query_shmid);
}
query_shmid = *(int *)(buf + sizeof(cookie));
if (query_shmid < 0) {
PARA_WARNING_LOG("received invalid query shmid %d)\n",
query_shmid);
- if (FD_ISSET(server_socket, &s->rfds)) {
- ret = execute_server_command();
- if (ret < 0) {
- PARA_EMERG_LOG("%s\n", para_strerror(-ret));
- sched_shutdown();
- return;
- }
+ ret = execute_server_command(&s->rfds);
+ if (ret < 0) {
+ PARA_EMERG_LOG("%s\n", para_strerror(-ret));
+ sched_shutdown(s);
+ return;
/* Check the list of connected clients. */
list_for_each_entry_safe(client, tmp, &afs_client_list, node) {
/* Check the list of connected clients. */
list_for_each_entry_safe(client, tmp, &afs_client_list, node) {
- if (FD_ISSET(client->fd, &s->rfds))
- execute_afs_command(client->fd, ct->cookie);
- else { /* prevent bogus connection flooding */
+ ret = execute_afs_command(client->fd, &s->rfds, ct->cookie);
+ if (ret == 0) { /* prevent bogus connection flooding */
struct timeval diff;
tv_diff(now, &client->connect_time, &diff);
if (diff.tv_sec < AFS_CLIENT_TIMEOUT)
struct timeval diff;
tv_diff(now, &client->connect_time, &diff);
if (diff.tv_sec < AFS_CLIENT_TIMEOUT)
- sprintf(ct->task.status, "command task");
- register_task(&ct->task);
+ sprintf(ct->task.status, "afs command task");
+ register_task(s, &ct->task);
INIT_LIST_HEAD(&afs_client_list);
for (i = 0; i < NUM_AFS_TABLES; i++)
afs_tables[i].init(&afs_tables[i]);
INIT_LIST_HEAD(&afs_client_list);
for (i = 0; i < NUM_AFS_TABLES; i++)
afs_tables[i].init(&afs_tables[i]);
PARA_INFO_LOG("server_socket: %d, afs_socket_cookie: %u\n",
server_socket, (unsigned) cookie);
init_admissible_files(conf.afs_initial_mode_arg);
PARA_INFO_LOG("server_socket: %d, afs_socket_cookie: %u\n",
server_socket, (unsigned) cookie);
init_admissible_files(conf.afs_initial_mode_arg);
- return rc4_send_va_buffer(rc4c, "%s\n", para_strerror(-ret));
+ /* ignore return value */
+ sc_send_va_buffer(scc, "%s\n", para_strerror(-ret));
if (ret < 0)
return ret;
}
if (flags & CHECK_PLAYLISTS) {
ret = send_callback_request(playlist_check_callback,
if (ret < 0)
return ret;
}
if (flags & CHECK_PLAYLISTS) {
ret = send_callback_request(playlist_check_callback,
if (ret < 0)
return ret;
}
if (flags & CHECK_MOODS) {
ret = send_callback_request(mood_check_callback, NULL,
if (ret < 0)
return ret;
}
if (flags & CHECK_MOODS) {
ret = send_callback_request(mood_check_callback, NULL,