]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
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 0b83cb4424654df83bb88eda953e158a966eeee7..b3b621035f026c0591e6044a7e39ac55893bef4a 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 fc617a3e8ac54ac3bc3d48e96398e0635d194a13..eb6175c2cf3692e7cd1d1714241dffd199e7b391 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 a5689390987ac9c9b063dad200653e990268824e..535d8c16075dc931d4ec935630e1de92362e3af5 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;
+}