]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
afs command task: Switch to the alternative post select method.
authorAndre Noll <maan@systemlinux.org>
Sun, 31 Mar 2013 18:11:48 +0000 (18:11 +0000)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Apr 2013 12:12:46 +0000 (14:12 +0200)
afs.c

diff --git a/afs.c b/afs.c
index 71b8b87e7dde2649ad6e0ad23f6a8bdf25a58e07..9daf7241b8214c82435454b163540eaa8213ed6f 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -916,7 +916,7 @@ err:
 /** 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;
@@ -924,16 +924,13 @@ static void command_post_select(struct sched *s, struct task *t)
        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) {
@@ -954,17 +951,18 @@ static void command_post_select(struct sched *s, struct task *t)
        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)
@@ -974,7 +972,8 @@ 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);
 }