X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=udp_recv.c;h=27a392d5fc4c836c60c52e30601fbb0dea5187e9;hp=c1f238308b58bab556434f57171be30db92944f2;hb=74c88020bd325865fe26ed25ea8ad0ace0924136;hpb=9de1287d67c9562e9140c6dc7deb0c01c4e10cc0 diff --git a/udp_recv.c b/udp_recv.c index c1f23830..27a392d5 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2012 Andre Noll + * Copyright (C) 2005-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -15,12 +15,12 @@ #include "list.h" #include "sched.h" #include "ggo.h" +#include "buffer_tree.h" #include "recv.h" #include "udp_recv.cmdline.h" #include "string.h" #include "net.h" #include "fd.h" -#include "buffer_tree.h" static void udp_recv_pre_select(struct sched *s, struct task *t) { @@ -49,7 +49,7 @@ static int udp_check_eof(size_t sz, struct iovec iov[2]) return -E_RECV_EOF; } -static void udp_recv_post_select(__a_unused struct sched *s, struct task *t) +static int udp_recv_post_select(__a_unused struct sched *s, struct task *t) { struct receiver_node *rn = container_of(t, struct receiver_node, task); struct btr_node *btrn = rn->btrn; @@ -57,7 +57,9 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t) struct iovec iov[2]; int ret, readv_ret, iovcnt; - t->error = 0; + ret = task_get_notification(t); + if (ret < 0) + goto out; ret = btr_node_status(btrn, 0, BTR_NT_ROOT); if (ret <= 0) goto out; @@ -81,12 +83,12 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t) } ret = readv_ret; out: - if (ret >= 0) - return; - btr_remove_node(btrn); - t->error = ret; - close(rn->fd); - rn->fd = -1; + if (ret < 0) { + btr_remove_node(&rn->btrn); + close(rn->fd); + rn->fd = -1; + } + return ret; } static void udp_recv_close(struct receiver_node *rn) @@ -221,7 +223,7 @@ void udp_recv_init(struct receiver *r) r->open = udp_recv_open; r->close = udp_recv_close; r->pre_select = udp_recv_pre_select; - r->post_select = udp_recv_post_select; + r->new_post_select = udp_recv_post_select; r->parse_config = udp_recv_parse_config; r->free_config = udp_recv_free_config; r->help = (struct ggo_help) {