Introduce generic_recv_pre_select().
authorAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 18:39:33 +0000 (19:39 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 18:39:33 +0000 (19:39 +0100)
http_recv.c
recv.h
recv_common.c

index 0b83cb4..b3b6210 100644 (file)
@@ -89,7 +89,13 @@ static void http_recv_pre_select(struct sched *s, struct task *t)
 {
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
        struct private_http_recv_data *phd = rn->private_data;
+       int ret;
 
+       if (rn->btrn) {
+               ret = generic_recv_pre_select(s, t);
+               if (ret <= 0)
+                       return;
+       }
        t->error = 0;
        if  (phd->status == HTTP_CONNECTED)
                para_fd_set(phd->fd, &s->wfds, &s->max_fileno);
diff --git a/recv.h b/recv.h
index fc617a3..eb6175c 100644 (file)
--- a/recv.h
+++ b/recv.h
@@ -136,3 +136,4 @@ extern struct receiver receivers[];
 void recv_init(void);
 void *check_receiver_arg(char *ra, int *receiver_num);
 void print_receiver_helps(int detailed);
+int generic_recv_pre_select(struct sched *s, struct task *t);
index a568939..535d8c1 100644 (file)
@@ -7,6 +7,7 @@
 /** \file recv_common.c common functions of para_recv and para_audiod */
 
 #include <regex.h>
+#include <stdbool.h>
 
 #include "para.h"
 #include "list.h"
@@ -14,6 +15,7 @@
 #include "ggo.h"
 #include "recv.h"
 #include "string.h"
+#include "buffer_tree.h"
 
 DEFINE_RECEIVER_ARRAY;
 
@@ -121,3 +123,16 @@ void print_receiver_helps(int detailed)
                ggo_print_help(&r->help, detailed);
        }
 }
+
+int generic_recv_pre_select(struct sched *s, struct task *t)
+{
+       struct receiver_node *rn = container_of(t, struct receiver_node, task);
+       int ret = btr_node_status(rn->btrn, 0, BTR_NT_ROOT);
+
+       t->error = 0;
+       if (ret < 0) {
+               s->timeout.tv_sec = 0;
+               s->timeout.tv_usec = 1;
+       }
+       return ret;
+}