/** Shutdown connection if query has not arrived until this many seconds. */
#define AFS_CLIENT_TIMEOUT 3
-static void command_post_select(struct sched *s, struct task *t)
+static int command_post_select(struct sched *s, struct task *t)
{
struct command_task *ct = container_of(t, struct command_task, task);
struct sockaddr_un unix_addr;
int fd, ret;
ret = task_get_notification(t);
- if (ret < 0) {
- t->error = ret;
- return;
- }
+ if (ret < 0)
+ return ret;
ret = execute_server_command(&s->rfds);
if (ret < 0) {
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
task_notify_all(s, -ret);
- t->error = ret;
- return;
+ return ret;
}
/* Check the list of connected clients. */
list_for_each_entry_safe(client, tmp, &afs_client_list, node) {
if (ret < 0)
PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
if (ret <= 0)
- return;
+ return 0;
ret = mark_fd_nonblocking(fd);
if (ret < 0) {
PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
close(fd);
- return;
+ return 0;
}
client = para_malloc(sizeof(*client));
client->fd = fd;
client->connect_time = *now;
para_list_add(&client->node, &afs_client_list);
+ return 0;
}
static void register_command_task(uint32_t cookie, struct sched *s)
ct->cookie = cookie;
ct->task.pre_select = command_pre_select;
- ct->task.post_select = command_post_select;
+ ct->task.new_post_select = command_post_select;
+ ct->task.post_select = NULL;
sprintf(ct->task.status, "afs command task");
register_task(s, &ct->task);
}