X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=udp_recv.c;h=00ad3e2781745c2e04af80dc462b75171e380dd0;hp=4f363ccb7f15b65273867526dcd43e9a98337b9c;hb=ce20ee3c755b47f753f122b0fb58a481a0a9d7b9;hpb=39f0303d96983d62b6f5dcdd453ff05f7874a49d diff --git a/udp_recv.c b/udp_recv.c index 4f363ccb..00ad3e27 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2009 Andre Noll + * Copyright (C) 2005-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -32,7 +32,6 @@ struct private_udp_recv_data { /** The socket file descriptor. */ int fd; struct btr_pool *btrp; - struct timeval last_read_time; }; static void udp_recv_pre_select(struct sched *s, struct task *t) @@ -78,20 +77,16 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t) goto err; if (ret == 0) return; - if (!FD_ISSET(purd->fd, &s->rfds)) { - struct timeval tmp; - tv_add(&purd->last_read_time, &(struct timeval)EMBRACE(5, 0), - &tmp); - ret = -E_UDP_TIMEOUT; - if (tv_diff(now, &tmp, NULL) > 0) - goto err; + if (!FD_ISSET(purd->fd, &s->rfds)) return; - } iovcnt = btr_pool_get_buffers(purd->btrp, iov); ret = -E_UDP_OVERRUN; if (iovcnt == 0) goto err; ret = para_readv(purd->fd, iov, iovcnt); + /* EAGAIN is possible even if FD_ISSET */ + if (ret < 0 && is_errno(-ret, EAGAIN)) + return; if (ret == 0) ret = -E_RECV_EOF; if (ret < 0) @@ -100,7 +95,6 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t) ret = udp_check_eof(packet_size, iov); if (ret < 0) goto err; - purd->last_read_time = *now; if (iov[0].iov_len >= packet_size) btr_add_output_pool(purd->btrp, packet_size, btrn); else { /* both buffers contain data */ @@ -229,7 +223,6 @@ static int udp_recv_open(struct receiver_node *rn) PARA_INFO_LOG("receiving from %s:%d, fd=%d\n", c->host_arg, c->port_arg, purd->fd); purd->btrp = btr_pool_new("udp_recv", 320 * 1024); - purd->last_read_time = *now; return purd->fd; err: free(rn->private_data);