From dde2e0b20798c7b8208ee8d3aea80388bcdb08ec Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 5 Jan 2010 19:39:33 +0100 Subject: [PATCH] Introduce generic_recv_pre_select(). --- http_recv.c | 6 ++++++ recv.h | 1 + recv_common.c | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/http_recv.c b/http_recv.c index 0b83cb44..b3b62103 100644 --- a/http_recv.c +++ b/http_recv.c @@ -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 fc617a3e..eb6175c2 100644 --- 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); diff --git a/recv_common.c b/recv_common.c index a5689390..535d8c16 100644 --- a/recv_common.c +++ b/recv_common.c @@ -7,6 +7,7 @@ /** \file recv_common.c common functions of para_recv and para_audiod */ #include +#include #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; +} -- 2.39.5