udp_recv: Kill non-btr code.
authorAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 01:39:46 +0000 (02:39 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 13 Jan 2010 01:39:46 +0000 (02:39 +0100)
udp_recv.c

index 6637988..61b5312 100644 (file)
@@ -40,68 +40,13 @@ static void udp_recv_pre_select(struct sched *s, struct task *t)
 {
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
        struct private_udp_recv_data *purd = rn->private_data;
-       int ret;
-
-       if (rn->btrn) {
-               ret = generic_recv_pre_select(s, t);
-               if (ret <= 0)
-                       return;
-       }
-       para_fd_set(purd->fd, &s->rfds, &s->max_fileno);
-}
-
-static int enough_space(size_t nbytes, size_t loaded)
-{
-       return nbytes + loaded < UDP_RECV_CHUNK_SIZE;
-}
-
-static int add_rn_output(struct receiver_node *rn, char *buf, size_t len)
-{
-       if (!len)
-               return 1;
-       if (!enough_space(len, rn->loaded))
-               return -E_UDP_OVERRUN;
-       memcpy(rn->buf + rn->loaded, buf, len);
-       rn->loaded += len;
-       return 1;
-}
-
-static void udp_recv_post_select_nobtr(__a_unused struct sched *s, struct task *t)
-{
-       struct receiver_node *rn = container_of(t, struct receiver_node, task);
-       struct private_udp_recv_data *purd = rn->private_data;
-       int ret;
-       char tmpbuf[UDP_RECV_CHUNK_SIZE];
-       size_t packet_size;
 
-       if (rn->output_error && *rn->output_error < 0) {
-               t->error = *rn->output_error;
+       if (generic_recv_pre_select(s, t) <= 0)
                return;
-       }
-       if (!FD_ISSET(purd->fd, &s->rfds))
-               return;
-       ret = recv_bin_buffer(purd->fd, tmpbuf, UDP_RECV_CHUNK_SIZE);
-       if (ret < 0) {
-               if (is_errno(ret, EINTR) || is_errno(ret, EAGAIN))
-                       goto success;
-               t->error = ret;
-               return;
-       }
-       t->error = -E_RECV_EOF;
-       if (!ret)
-               return;
-       packet_size = ret;
-       if (packet_size >= FEC_EOF_PACKET_LEN)
-               if (!memcmp(tmpbuf, FEC_EOF_PACKET, FEC_EOF_PACKET_LEN))
-                       return;
-       t->error = add_rn_output(rn, tmpbuf, packet_size);
-       if (t->error < 0)
-               return;
-success:
-       t->error = 1;
+       para_fd_set(purd->fd, &s->rfds, &s->max_fileno);
 }
 
-static void udp_recv_post_select_btr(__a_unused struct sched *s, struct task *t)
+static void udp_recv_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
        struct private_udp_recv_data *purd = rn->private_data;
@@ -144,14 +89,6 @@ err:
        purd->fd = -1;
 }
 
-static void udp_recv_post_select(__a_unused struct sched *s, struct task *t)
-{
-       struct receiver_node *rn = container_of(t, struct receiver_node, task);
-       if (rn->btrn)
-               return udp_recv_post_select_btr(s, t);
-       udp_recv_post_select_nobtr(s, t);
-}
-
 static void udp_recv_close(struct receiver_node *rn)
 {
        struct private_udp_recv_data *purd = rn->private_data;