X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client.c;h=da075e09e2004c1b739ee87e68d2a932fa009315;hp=715df9c6a3aa8b107ef4bcfdffaad9a0c1abea2f;hb=74c88020bd325865fe26ed25ea8ad0ace0924136;hpb=f652ce6afe7f6fd0e42814505234cbf4321a736e diff --git a/client.c b/client.c index 715df9c6..da075e09 100644 --- a/client.c +++ b/client.c @@ -54,7 +54,7 @@ static void exec_pre_select(struct sched *s, struct task *t) sched_min_delay(s); } -static void exec_post_select(__a_unused struct sched *s, struct task *t) +static int exec_post_select(__a_unused struct sched *s, struct task *t) { struct exec_task *et = container_of(t, struct exec_task, task); struct btr_node *btrn = et->btrn; @@ -63,10 +63,8 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t) int ret; ret = btr_node_status(btrn, 0, BTR_NT_LEAF); - if (ret <= 0) { - t->error = ret; - return; - } + if (ret <= 0) + return ret; sz = btr_next_buffer(btrn, &buf); if (sz <= 1) goto out; @@ -76,6 +74,7 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t) et->result_buf[et->result_size - 1] = '\0'; out: btr_consume(btrn, sz); + return 0; } static int make_client_argv(const char *line) @@ -96,7 +95,7 @@ static int execute_client_command(const char *cmd, char **result) struct exec_task exec_task = { .task = { .pre_select = exec_pre_select, - .post_select = exec_post_select, + .new_post_select = exec_post_select, .status = "client exec task", }, .result_buf = para_strdup(""), @@ -531,27 +530,25 @@ __noreturn static void print_completions(void) #endif /* HAVE_READLINE */ -static void supervisor_post_select(struct sched *s, struct task *t) +static int supervisor_post_select(struct sched *s, __a_unused struct task *t) { - if (ct->task.error < 0) { - t->error = ct->task.error; - return; - } + if (ct->task.error < 0) + return ct->task.error; if (ct->status == CL_SENDING) { stdin_set_defaults(&sit); register_task(s, &sit.task); - t->error = -E_TASK_STARTED; - return; + return -E_TASK_STARTED; } if (ct->status == CL_RECEIVING) { stdout_set_defaults(&sot); register_task(s, &sot.task); - t->error = -E_TASK_STARTED; return; + return -E_TASK_STARTED; } + return 0; } static struct task svt = { - .post_select = supervisor_post_select, + .new_post_select = supervisor_post_select, .status = "supervisor task" };