From a512404111e4134a300e8da66fcacc12cd05f2a9 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 13 Jan 2010 02:39:46 +0100 Subject: [PATCH] udp_recv: Kill non-btr code. --- udp_recv.c | 69 +++--------------------------------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) diff --git a/udp_recv.c b/udp_recv.c index 6637988a..61b5312f 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -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; -- 2.39.5