udp_recv: Switch to the alternative post select method.
authorAndre Noll <maan@systemlinux.org>
Sun, 31 Mar 2013 12:49:42 +0000 (12:49 +0000)
committerAndre Noll <maan@systemlinux.org>
Tue, 30 Apr 2013 12:12:45 +0000 (14:12 +0200)
udp_recv.c

index 6c5ee02..4707869 100644 (file)
@@ -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;
@@ -83,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(&rn->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)
@@ -223,7 +223,8 @@ 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->post_select = NULL;
+       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) {