From: Andre Noll Date: Sun, 31 Mar 2013 18:11:48 +0000 (+0000) Subject: afs command task: Switch to the alternative post select method. X-Git-Tag: v0.4.13~39^2~11 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=b210e853c39749a2e425e1048f8a471d2c1c1462 afs command task: Switch to the alternative post select method. --- diff --git a/afs.c b/afs.c index 71b8b87e..9daf7241 100644 --- 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); }