From: Andre Noll Date: Sun, 17 Oct 2010 11:04:55 +0000 (+0200) Subject: Merge branch 't/sched_cleanups' X-Git-Tag: v0.4.5~25 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=5bf80b0268b0afb3984aea74d41eddef34d50d03;hp=7ff087268774d4bb7838a8575d2d9471ab52a27d;p=paraslash.git Merge branch 't/sched_cleanups' --- diff --git a/NEWS b/NEWS index cb7ba06d..17cd87a9 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,11 @@ 0.4.5 (to be announced) "symmetric randomization" ------------------------------------------------- - - Fix an invalid-free-bug in the ogg audio format handler code. + - Contains a fix for an invalid-free-bug in the ogg audio format + handler code. + - Improved documentation and error diagnostics. + - Switching off the DCCP sender works again. + - para_audiod handles crashes of para_server more robustly. ------------------------------------------ 0.4.4 (2010-08-06) "persistent regularity" diff --git a/audiod.c b/audiod.c index 668b0f74..89b160db 100644 --- a/audiod.c +++ b/audiod.c @@ -1222,6 +1222,8 @@ static void status_post_select(__a_unused struct sched *s, struct task *t) st->min_iqs = sz + 1; goto out; } + btr_drain(st->btrn); + st->current_audio_format_num = -1; if (tv_diff(now, &st->restart_barrier, NULL) < 0) goto out; if (st->clock_diff_count) { /* get status only one time */ diff --git a/buffer_tree.c b/buffer_tree.c index d92d9863..bdcbec8d 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -660,9 +660,10 @@ void btr_consume(struct btr_node *btrn, size_t numbytes) return btr_consume(btrn, sz); } -static void flush_input_queue(struct btr_node *btrn) +void btr_drain(struct btr_node *btrn) { struct btr_buffer_reference *br, *tmp; + FOR_EACH_BUFFER_REF_SAFE(br, tmp, btrn) btr_drop_buffer_reference(br); } @@ -670,6 +671,8 @@ static void flush_input_queue(struct btr_node *btrn) /** * Free all resources allocated by btr_new_node(). * + * \param btrn Pointer to a btr node obtained by \ref btr_new_node(). + * * Like free(3), it is OK to call this with a \p NULL pointer argument. */ void btr_free_node(struct btr_node *btrn) @@ -700,7 +703,7 @@ void btr_remove_node(struct btr_node *btrn) PARA_NOTICE_LOG("removing btr node %s from buffer tree\n", btrn->name); FOR_EACH_CHILD(ch, btrn) ch->parent = NULL; - flush_input_queue(btrn); + btr_drain(btrn); if (btrn->parent) list_del(&btrn->node); } diff --git a/buffer_tree.h b/buffer_tree.h index 549f95a2..8bc8e602 100644 --- a/buffer_tree.h +++ b/buffer_tree.h @@ -202,3 +202,4 @@ int btr_node_status(struct btr_node *btrn, size_t min_iqs, enum btr_node_type type); void btr_get_node_start(struct btr_node *btrn, struct timeval *tv); struct btr_node *btr_search_node(const char *name, struct btr_node *root); +void btr_drain(struct btr_node *btrn); diff --git a/dccp_send.c b/dccp_send.c index 41aaf234..a2ee0270 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -155,6 +155,7 @@ static int dccp_com_on(__a_unused struct sender_command_data *scd) static int dccp_com_off(__a_unused struct sender_command_data *scd) { + dccp_shutdown_clients(); generic_com_off(dss); return 1; } diff --git a/mood.c b/mood.c index d24eac91..89ad80d9 100644 --- a/mood.c +++ b/mood.c @@ -890,6 +890,17 @@ static int reload_current_mood(void) return ret; } +/** + * Notification callback for the moods table. + * + * \param event Type of the event just occurred. + * \param pb Unused. + * \param data Its type depends on the event. + * + * This function performs actions required due to the occurrence of the given + * event. Possible actions include reload of the current mood and update of the + * score of an audio file. + */ int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb, void *data) { @@ -926,4 +937,3 @@ int moods_event_handler(enum afs_events event, __a_unused struct para_buffer *pb return 1; } } - diff --git a/net.c b/net.c index 32f3ffe9..64602a4b 100644 --- a/net.c +++ b/net.c @@ -951,7 +951,7 @@ int connect_local_socket(const char *name) struct sockaddr_un unix_addr; int fd, ret; - PARA_INFO_LOG("connecting to %s\n", name); + PARA_DEBUG_LOG("connecting to %s\n", name); ret = init_unix_addr(&unix_addr, name); if (ret < 0) return ret; diff --git a/para.h b/para.h index 287e3c7a..afb63821 100644 --- a/para.h +++ b/para.h @@ -49,70 +49,6 @@ typeof(x) _x = (x); \ _x > 0? _x : -_x; }) -/** Debug loglevel, gets really noisy. */ -#define LL_DEBUG 0 -/** Still noisy, but won't fill your disk. */ -#define LL_INFO 1 -/** Normal, but significant event. */ -#define LL_NOTICE 2 -/** Unexpected event that can be handled. */ -#define LL_WARNING 3 -/** Unhandled error condition. */ -#define LL_ERROR 4 -/** System might be unreliable. */ -#define LL_CRIT 5 -/** Last message before exit. */ -#define LL_EMERG 6 -/** Number of all loglevels. */ -#define NUM_LOGLEVELS 7 - -/** Log messages with lower priority than that will not be compiled in. */ -#define COMPILE_TIME_LOGLEVEL 0 - -/** \cond */ -#if LL_DEBUG >= COMPILE_TIME_LOGLEVEL -#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_DEBUG_LOG(...) do {;} while (0) -#endif - -#if LL_INFO >= COMPILE_TIME_LOGLEVEL -#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_INFO_LOG(...) do {;} while (0) -#endif - -#if LL_NOTICE >= COMPILE_TIME_LOGLEVEL -#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_NOTICE_LOG(...) do {;} while (0) -#endif - -#if LL_WARNING >= COMPILE_TIME_LOGLEVEL -#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_WARNING_LOG(...) do {;} while (0) -#endif - -#if LL_ERROR >= COMPILE_TIME_LOGLEVEL -#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_ERROR_LOG(...) do {;} while (0) -#endif - -#if LL_CRIT >= COMPILE_TIME_LOGLEVEL -#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_CRIT_LOG(...) do {;} while (0) -#endif - -#if LL_EMERG >= COMPILE_TIME_LOGLEVEL -#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) -#else -#define PARA_EMERG_LOG(...) -#endif -/** \endcond */ - /** * define a standard log function that always writes to stderr * @@ -265,7 +201,7 @@ _static_inline_ long int para_random(unsigned max) * It may be determined by one of the following sources: * * 1. The decoding filter (para_audiod only). In this case, it is always - * \t SF_S16_LE which is the canonical format used within decoders. + * \p SF_S16_LE which is the canonical format used within decoders. * * 2. The wav header (para_write only). * @@ -283,3 +219,67 @@ _static_inline_ long int para_random(unsigned max) enum sample_format {SAMPLE_FORMATS}; #undef SAMPLE_FORMAT #define SAMPLE_FORMAT(a, b) b + +/** Debug loglevel, gets really noisy. */ +#define LL_DEBUG 0 +/** Still noisy, but won't fill your disk. */ +#define LL_INFO 1 +/** Normal, but significant event. */ +#define LL_NOTICE 2 +/** Unexpected event that can be handled. */ +#define LL_WARNING 3 +/** Unhandled error condition. */ +#define LL_ERROR 4 +/** System might be unreliable. */ +#define LL_CRIT 5 +/** Last message before exit. */ +#define LL_EMERG 6 +/** Number of all loglevels. */ +#define NUM_LOGLEVELS 7 + +/** Log messages with lower priority than that will not be compiled in. */ +#define COMPILE_TIME_LOGLEVEL 0 + +/** \cond */ +#if LL_DEBUG >= COMPILE_TIME_LOGLEVEL +#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_DEBUG_LOG(...) do {;} while (0) +#endif + +#if LL_INFO >= COMPILE_TIME_LOGLEVEL +#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_INFO_LOG(...) do {;} while (0) +#endif + +#if LL_NOTICE >= COMPILE_TIME_LOGLEVEL +#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_NOTICE_LOG(...) do {;} while (0) +#endif + +#if LL_WARNING >= COMPILE_TIME_LOGLEVEL +#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_WARNING_LOG(...) do {;} while (0) +#endif + +#if LL_ERROR >= COMPILE_TIME_LOGLEVEL +#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_ERROR_LOG(...) do {;} while (0) +#endif + +#if LL_CRIT >= COMPILE_TIME_LOGLEVEL +#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_CRIT_LOG(...) do {;} while (0) +#endif + +#if LL_EMERG >= COMPILE_TIME_LOGLEVEL +#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__) +#else +#define PARA_EMERG_LOG(...) +#endif +/** \endcond */ diff --git a/recv.h b/recv.h index 0da3fd69..271932b1 100644 --- a/recv.h +++ b/recv.h @@ -100,18 +100,6 @@ struct receiver { struct ggo_help help; }; - -/** \cond */ -extern void http_recv_init(struct receiver *r); -#define HTTP_RECEIVER {.name = "http", .init = http_recv_init}, -extern void dccp_recv_init(struct receiver *r); -#define DCCP_RECEIVER {.name = "dccp", .init = dccp_recv_init}, -extern void udp_recv_init(struct receiver *r); -#define UDP_RECEIVER {.name = "udp", .init = udp_recv_init}, - -extern struct receiver receivers[]; -/** \endcond */ - /** Define an array of all available receivers. */ #define DEFINE_RECEIVER_ARRAY struct receiver receivers[] = { \ HTTP_RECEIVER \ @@ -126,3 +114,15 @@ 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); + +/** \cond */ +extern void http_recv_init(struct receiver *r); +#define HTTP_RECEIVER {.name = "http", .init = http_recv_init}, +extern void dccp_recv_init(struct receiver *r); +#define DCCP_RECEIVER {.name = "dccp", .init = dccp_recv_init}, +extern void udp_recv_init(struct receiver *r); +#define UDP_RECEIVER {.name = "udp", .init = udp_recv_init}, + +extern struct receiver receivers[]; +/** \endcond */ + diff --git a/udp_recv.c b/udp_recv.c index 8e2fcf2f..f008f1ed 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -145,7 +145,8 @@ static int mcast_receiver_setup(int fd, const char *iface) assert(ss.ss_family == AF_INET || ss.ss_family == AF_INET6); if (iface != NULL && id == 0) - PARA_WARNING_LOG("could not resolve interface %s, using default", iface); + PARA_WARNING_LOG("could not resolve interface %s, using default\n", + iface); switch (ss.ss_family) { case AF_INET: @@ -160,12 +161,13 @@ static int mcast_receiver_setup(int fd, const char *iface) m4.imr_interface.s_addr = INADDR_ANY; if (id != 0) - PARA_ERROR_LOG("Setting IPv4 receiver mcast interface not supported."); + PARA_ERROR_LOG("Setting IPv4 receiver mcast interface not supported\n"); #endif - m4.imr_multiaddr = ((struct sockaddr_in *)&ss)->sin_addr; + m4.imr_multiaddr = ((struct sockaddr_in *)&ss)->sin_addr; - if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &m4, sizeof(m4)) < 0) + if (setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + &m4, sizeof(m4)) < 0) break; } return 0; diff --git a/web/download.in.html b/web/download.in.html index b5ea7505..d735d5e8 100644 --- a/web/download.in.html +++ b/web/download.in.html @@ -5,9 +5,12 @@ download directory -or grab the current +or grab a -snapshot. +tarball + +of the current master branch. This version is expected to be more +stable than any of the released versions. All regular releases are cryptographically signed. @@ -15,7 +18,7 @@ Anonymous (read-only) git -access is also available. Checkout a copy with

+access is also available. Check out a copy with

git clone git://paraslash.systemlinux.org/git paraslash