Revert "udp_recv: Close receiver after 5 seconds of inactivitly."
authorAndre Noll <maan@systemlinux.org>
Thu, 25 Mar 2010 20:36:27 +0000 (21:36 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 25 Mar 2010 20:36:27 +0000 (21:36 +0100)
This reverts commit 4d4379901a0a01859728d56795a7ab6ada9c876b.

This was not really a good idea as it only papers over the real bug.
A better fix is to check whether the currently active buffer tree
matches the status information obtained from para_server. This will
be implemented in a subsequent patch.

error.h
udp_recv.c

diff --git a/error.h b/error.h
index 2cca4c2ef3d86c1d3c983661a342f8c2abb9c8a6..731387c725312b145efbd7bb9d14350dc2d3b328 100644 (file)
--- a/error.h
+++ b/error.h
@@ -234,7 +234,6 @@ extern const char **para_errlist[];
 #define UDP_RECV_ERRORS \
        PARA_ERROR(UDP_SYNTAX, "udp_recv syntax error"), \
        PARA_ERROR(UDP_OVERRUN, "output buffer overrun"), \
 #define UDP_RECV_ERRORS \
        PARA_ERROR(UDP_SYNTAX, "udp_recv syntax error"), \
        PARA_ERROR(UDP_OVERRUN, "output buffer overrun"), \
-       PARA_ERROR(UDP_TIMEOUT, "timeout reading on UDP socket"), \
 
 
 #define HTTP_RECV_ERRORS \
 
 
 #define HTTP_RECV_ERRORS \
index 316957d51050fc6e2751bfd6a48f9d1034a9e285..059561424efb30487511a4cbbca70805be3d6247 100644 (file)
@@ -32,7 +32,6 @@ struct private_udp_recv_data {
        /** The socket file descriptor. */
        int fd;
        struct btr_pool *btrp;
        /** 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)
 };
 
 static void udp_recv_pre_select(struct sched *s, struct task *t)
@@ -78,15 +77,8 @@ static void udp_recv_post_select(__a_unused struct sched *s, struct task *t)
                goto err;
        if (ret == 0)
                return;
                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;
                return;
-       }
        iovcnt = btr_pool_get_buffers(purd->btrp, iov);
        ret = -E_UDP_OVERRUN;
        if (iovcnt == 0)
        iovcnt = btr_pool_get_buffers(purd->btrp, iov);
        ret = -E_UDP_OVERRUN;
        if (iovcnt == 0)
@@ -103,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;
        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 */
        if (iov[0].iov_len >= packet_size)
                btr_add_output_pool(purd->btrp, packet_size, btrn);
        else { /* both buffers contain data */
@@ -232,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);
        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);
        return purd->fd;
 err:
        free(rn->private_data);