BINDIR = @bindir@
VARDIR = /var/paraslash
-PKGDATADIR = @datadir@/@PACKAGE_NAME@
+PKGDATADIR = @datarootdir@/@PACKAGE_NAME@
FONTDIR = $(PKGDATADIR)/fonts
PICDIR = $(PKGDATADIR)/pics
-MANDIR = @prefix@/share/man/man1
+MANDIR = @datarootdir@/man/man1
install_sh = @install_sh@
-SSL_LIBS = @SSL_LIBS@
-SSL_LDFLAGS = @SSL_LDFLAGS@
-extra_binaries = @extra_binaries@
build_date = $(shell date)
system = $(shell uname -rs)
cc_version = $(shell $(CC) --version | head -n 1)
-version = @PACKAGE_VERSION@
codename = oriented abstraction
DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
CPPFLAGS += -DPICDIR='"$(PKGDATADIR)/pics"'
CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
CPPFLAGS += -DSYSTEM='"$(system)"'
-CPPFLAGS += -DVERSION='"$(version)"'
CPPFLAGS += -DCODENAME='"$(codename)"'
CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
CPPFLAGS += -Werror-implicit-function-declaration
CPPFLAGS += -Wunused-macros
CPPFLAGS += -Wshadow
-BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write $(extra_binaries)
+BINARIES = para_server para_client para_gui para_audiod para_audioc para_recv para_filter para_write @extra_binaries@
FONTS := $(wildcard fonts/*.png)
PICS := $(wildcard pics/paraslash/*.jpg)
A bunch of new features and core changes.
- the new paraslash scheduler, short and sweet.
- - Support for m4a files via the new aac filter/ and audio
- format handler (requires libfaad).
+ - Support for m4a/mp4 files via the new aac audio format
+ handler/filter (requires libfaad).
- each writer has its own command line parser, just like
para_recv and para_filter.
- new writer: osxplay (thanks to Gerd Becker)
- para_client is integrated in para_audiod
- random/playlist selector: improved info strings
- new audiod commands: tasks, kill
- - update to libortp-0.10.0
+ - update to libortp-0.10.1
- para_fade: wake time defaults to 8 hours from now
+ - update to autoconf-2.60
------------------------------------------
#include <string.h> /* strlen */
SFont_FontInfo InternalFont;
-Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
+static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
{
Uint8 *bits;
return *((Uint8 *) Surface->pixels + Y * Surface->pitch + X);
break;
case 2:
- return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 +
- X);
+ return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 + X);
break;
case 3:{ /* Format/endian independent */
Uint8 r, g, b;
}
break;
case 4:
- return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 +
- X);
+ return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 + X);
break;
}
while (x < Font->Surface->w) {
if (GetPixel(Font->Surface, x, 0) ==
- SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
+ SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
Font->CharPos[i++] = x;
- while ((x < Font->Surface->w - 1)
- && (GetPixel(Font->Surface, x, 0) ==
- SDL_MapRGB(Font->Surface->format, 255, 0,
- 255)))
+ while ((x < Font->Surface->w - 1) &&
+ (GetPixel(Font->Surface, x, 0) ==
+ SDL_MapRGB(Font->Surface->format, 255, 0, 255)))
x++;
Font->CharPos[i++] = x;
}
GetPixel(Font->Surface, 0, Font->Surface->h - 1));
}
-#if 0
-void InitFont(SDL_Surface * Font)
-{
- InternalFont.Surface = Font;
- InitFont2(&InternalFont);
-}
-
-#endif
-
-
-
void PutString2(SDL_Surface * Surface, SFont_FontInfo * Font, int x, int y,
const char *text)
{
ofs = ((unsigned char) text[i] - 33) * 2 + 1;
srcrect.w = dstrect.w = (Font->CharPos[ofs + 2]
+ Font->CharPos[ofs + 1]) / 2
- - (Font->CharPos[ofs] + Font->CharPos[ofs - 1])
- / 2;
+ - (Font->CharPos[ofs]
+ + Font->CharPos[ofs - 1]) / 2;
srcrect.h = dstrect.h = Font->Surface->h - 1;
- srcrect.x =
- (Font->CharPos[ofs] + Font->CharPos[ofs - 1]) / 2;
+ srcrect.x = (Font->CharPos[ofs]
+ + Font->CharPos[ofs - 1]) / 2;
srcrect.y = 1;
- dstrect.x =
- x - (float) (Font->CharPos[ofs] -
- Font->CharPos[ofs - 1]) / 2;
+ dstrect.x = x - (float) (Font->CharPos[ofs]
+ - Font->CharPos[ofs - 1]) / 2;
dstrect.y = y;
SDL_BlitSurface(Font->Surface, &srcrect, Surface,
&dstrect);
return x;
}
-void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
+static void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
int y, int PixelWidth, char *text)
{
SDL_Event event;
blinktimer = SDL_GetTicks() + 500;
if (blink) {
PutString2(Dest, Font,
- x + TextWidth2(Font, text), y, "|");
+ x + TextWidth2(Font, text), y, "|");
SDL_UpdateRects(Dest, 1, &rect);
} else {
SDL_BlitSurface(Back, NULL, Dest, &rect);
}
void SFont_Input2(SDL_Surface * Dest, SFont_FontInfo * Font, int x, int y,
- int PixelWidth, char *text)
+ int PixelWidth, char *text)
{
SFont_InternalInput(Dest, Font, x, y, PixelWidth, text);
}
return (char *)inbuf;
}
-static const char* aac_suffixes[] = {"m4a", NULL};
+static const char* aac_suffixes[] = {"m4a", "mp4", NULL};
/** the init function of the aac audio format handler */
void aac_afh_init(struct audio_format_handler *p)
{
}
}
-static void open_receiver(int format)
+static int open_receiver(int format)
{
struct audio_format_info *a = &afi[format];
struct slot_info *s;
int ret, slot_num;
struct receiver_node *rn;
+ const struct timeval restart_delay = {1, 0};
- slot_num = get_empty_slot();
- if (slot_num < 0)
- clean_exit(EXIT_FAILURE, PARA_STRERROR(-slot_num));
+ ret = get_empty_slot();
+ if (ret < 0)
+ goto err;
+ slot_num = ret;
s = &slot[slot_num];
s->format = format;
s->receiver_node = para_calloc(sizeof(struct receiver_node));
rn->conf = a->receiver_conf;
ret = a->receiver->open(s->receiver_node);
if (ret < 0) {
- PARA_ERROR_LOG("failed to open receiver (%s)\n",
- PARA_STRERROR(-ret));
free(s->receiver_node);
s->receiver_node = NULL;
- return;
+ goto err;
}
PARA_NOTICE_LOG("started %s: %s receiver in slot %d\n",
audio_formats[s->format], a->receiver->name, slot_num);
rn->task.event_handler = rn_event_handler;
sprintf(rn->task.status, "%s receiver node", rn->receiver->name);
register_task(&rn->task);
+ return 1;
+err:
+ PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
+ tv_add(now, &restart_delay, &afi[format].restart_barrier);
+ return ret;
}
static int receiver_running(int format)
s->timeout = diff;
return 0;
}
- open_receiver(i);
- return 1;
+ return open_receiver(i) < 0? 0 : 1;
}
static void compute_time_diff(const struct timeval *status_time)
{
int i;
- /* save away the current time for other users */
t->ret = 1;
FOR_EACH_SLOT(i)
try_to_close_slot(i);
struct command_task *ct = t->private_data;
t->ret = 1; /* always successful */
- if (audiod_status != AUDIOD_OFF)
- audiod_status_dump();
+ audiod_status_dump();
if (!FD_ISSET(ct->fd, &s->rfds))
return;
ret = handle_connect(ct->fd);
void __noreturn clean_exit(int status, const char *msg);
int handle_connect(int accept_fd);
void audiod_status_dump(void);
+void dump_empty_status(void);
/** iterate over all slots */
#define FOR_EACH_SLOT(_slot) for (_slot = 0; _slot < MAX_STREAM_SLOTS; _slot++)
void audiod_status_dump(void)
{
- static char *p_ts, *p_us, *p_as, *p_df;
struct timeval *t = wstime();
- char *us, *tmp = get_time_string(t);
-
- if (tmp && (!p_ts || strcmp(tmp, p_ts)))
- stat_client_write(tmp, SI_PLAY_TIME);
- free(p_ts);
- p_ts = tmp;
+ char *old, *new, *tmp;
+
+ old = stat_task->stat_item_values[SI_PLAY_TIME];
+ new = get_time_string(t);
+ if (new) {
+ if (!old || strcmp(old, new)) {
+ free(old);
+ stat_client_write(new, SI_PLAY_TIME);
+ stat_task->stat_item_values[SI_PLAY_TIME] = new;
+ } else
+ free(new);
+ }
- us = uptime_str();
- tmp = make_message("%s:%s\n", status_item_list[SI_AUDIOD_UPTIME], us);
- free(us);
- if (!p_us || strcmp(p_us, tmp))
+ new = uptime_str();
+ old = stat_task->stat_item_values[SI_AUDIOD_UPTIME];
+ if (!old || strcmp(old, new)) {
+ free(old);
+ tmp = make_message("%s:%s\n",
+ status_item_list[SI_AUDIOD_UPTIME], new);
stat_client_write(tmp, SI_AUDIOD_UPTIME);
- free(p_us);
- p_us = tmp;
-
- tmp = audiod_status_string();
- if (!p_as || strcmp(p_as, tmp))
- stat_client_write(tmp, SI_AUDIOD_STATUS);
- free(p_as);
- p_as = tmp;
-
- tmp = decoder_flags();
- if (!p_df || strcmp(p_df, tmp))
- stat_client_write(tmp, SI_DECODER_FLAGS);
- free(p_df);
- p_df = tmp;
+ free(tmp);
+ stat_task->stat_item_values[SI_AUDIOD_UPTIME] = new;
+ } else
+ free(new);
+
+ old = stat_task->stat_item_values[SI_AUDIOD_STATUS];
+ new = audiod_status_string();
+ if (!old || strcmp(old, new)) {
+ free(old);
+ stat_client_write(new, SI_AUDIOD_STATUS);
+ stat_task->stat_item_values[SI_AUDIOD_STATUS] = new;
+ } else
+ free(new);
+
+ old = stat_task->stat_item_values[SI_DECODER_FLAGS];
+ new = decoder_flags();
+ if (!old || strcmp(old, new)) {
+ stat_client_write(new, SI_DECODER_FLAGS);
+ stat_task->stat_item_values[SI_DECODER_FLAGS] = new;
+ } else
+ free(new);
}
+/**
+ * send empty status list
+ *
+ * Send to each connected client the full status item list
+ * with empty values.
+ */
+void dump_empty_status(void)
+{
+ int i;
+
+ FOR_EACH_STAT_ITEM(i) {
+ char *tmp = make_message("%s:\n", status_item_list[i]);
+ stat_client_write(tmp, i);
+ free(tmp);
+ free(stat_task->stat_item_values[i]);
+ stat_task->stat_item_values[i] = NULL;
+ }
+}
va_list argp;
/* ignore log message if loglevel is not high enough */
- if (!pcd || ll < pcd->conf.loglevel_arg)
+ if (pcd && ll < pcd->conf.loglevel_arg)
return;
va_start(argp, fmt);
vfprintf(stderr, fmt, argp);
case CL_SENDING: /* FIXME: might block */
PARA_INFO_LOG("loaded: %zd\n", *pcd->in_loaded);
t->ret = send_bin_buffer(pcd->fd, pcd->inbuf, *pcd->in_loaded);
- if (t->ret <= 0) {
- if (!t->ret)
- t->ret = 1;
+ if (t->ret < 0)
return;
- }
*pcd->in_loaded = 0; /* FIXME: short writes */
return;
case CL_RECEIVING:
{
if (argc != 1)
return -E_COMMAND_SYNTAX;
- return send_buffer(socket_fd, "para_server-" VERSION ", \"" CODENAME "\"\n"
+ return send_buffer(socket_fd, "para_server-" PACKAGE_VERSION ", \""
+ CODENAME "\"\n"
COPYRIGHT "\n"
"built: " BUILD_DATE "\n"
SYSTEM ", " CC_VERSION "\n"
in_addr = addr;
challenge_nr = random();
/* send Welcome message */
- ret = send_va_buffer(fd, "This is para_server, version " VERSION ".\n" );
+ ret = send_va_buffer(fd, "This is para_server, version "
+ PACKAGE_VERSION ".\n" );
if (ret < 0)
goto err_out;
/* recv auth request line */
option "blocksize" b "larger blocksize means fewer volume adjustments per time unit" int typestr="number" default="16" optional
option "aggressiveness" a "controls the maximum amount to amplify by" int typestr="number" default="2" optional
option "inertia" i "how much inertia ramping has" int typestr="number" default="6" optional
-option "target_level" t "target signal level (0-32768)" int typestr="number" default="25000" optional
+option "target_level" t "target signal level (0-32768)" int typestr="number" default="20000" optional
option "damp" d "if non-zero, scale down after normalizing" int typestr="number" default="0" optional
*/
void log_welcome(const char *whoami, int loglevel)
{
- PARA_INFO_LOG("welcome to %s " VERSION " ("BUILD_DATE")\n", whoami);
+ PARA_INFO_LOG("welcome to %s " PACKAGE_VERSION " ("BUILD_DATE")\n",
+ whoami);
PARA_DEBUG_LOG("using loglevel %d\n", loglevel);
}
// ITEM **items;
int i;
char buf[MAXLINE] = "para_client sa ";
+ int fds[3] = {0, 0, 0};
+ pid_t pid;
for (i = 0; i < n_choices; ++i) {
strcat(buf, item_name(my_items[i]));
strcat(buf, filename);
//printf("old atts: %s\n", atts);
//printf("%s\n", buf);
- return system(buf);
+ return para_exec_cmdline_pid(&pid, buf, fds);
}
static char *get_current_filename(void)
goto repeat;
/* Enter */
case 10:
- endwin();
if (atts_modified)
commit_changes(filename);
- else
- printf("Attributes unchanged\n");
goto out;
default:
goto repeat;
out:
if (my_items) {
free_item(my_items[0]);
- free_item(my_items[1]);
+ free_item(my_items[1]);
}
for (i = 0; i < n_choices; i++)
free(choices[i]);
free(dc);
}
+#define DCCP_RETRIES 100
+
static int dccp_write(int fd, const char *buf, size_t len)
{
size_t size, written = 0;
- int ret;
+ int ret, retries = 0;
again:
size = PARA_MIN(1024, len - written);
ret = write(fd, buf + written, size);
- if (ret < 0)
- goto err_out;
+ if (ret < 0) {
+ if (errno != EAGAIN || !retries++ > DCCP_RETRIES)
+ goto err_out;
+ PARA_DEBUG_LOG("EAGAIN #%d@%d/%d\n", retries, written, len);
+ goto again;
+ }
+ retries = 0;
written += ret;
if (written >= len)
return written;
* \param n the highest-numbered descriptor in any of the two sets, plus 1
* \param readfds fds that should be checked for readability
* \param writefds fds that should be checked for writablility
- * \param timeout upper bound on the amount of time elapsed before select()
- * returns
+ * \param timeout_tv upper bound on the amount of time elapsed before select()
+ * returns
*
* \return The return value of the underlying select() call.
*
/**
* activate inactive grab clients if possible
*
- * \param slot audiod's slot for the new audio file
+ * \param slot_num audiod's slot for the new audio file
* \param audio_format_num the number of the audio format of the new audio file
* \param filter_list the list of activated filters for that new audio file
*
extern const char *status_item_list[NUM_STAT_ITEMS];
static char *stat_content[NUM_STAT_ITEMS];
-#define STANDARD_STATUS_BAR "para_gui " VERSION " (hit ? for help)"
+#define STANDARD_STATUS_BAR "para_gui " PACKAGE_VERSION " (hit ? for help)"
static int signal_pipe;
if (!curses_active)
return;
wmove(sb.win, 0, 0);
- align_str(sb.win,STANDARD_STATUS_BAR, sb.cols, CENTER);
+ align_str(sb.win, STANDARD_STATUS_BAR, sb.cols, CENTER);
wrefresh(sb.win);
}
int ll = conf.loglevel_arg;
if (ll > NOTICE)
return;
- outputf(COLOR_WELCOME, "Welcome to para_gui " VERSION
+ outputf(COLOR_WELCOME, "Welcome to para_gui " PACKAGE_VERSION
" \"" CODENAME "\". Theme: %s", theme.name);
wclrtoeol(bot.win);
}
static void com_version(void)
{
- print_in_bar(COLOR_MSG, "para_gui " VERSION " \"" CODENAME "\"");
+ print_in_bar(COLOR_MSG, "para_gui " PACKAGE_VERSION " \""
+ CODENAME "\"");
}
static void com_quit(void)
option "config_file" c "(default='~/.paraslash/gui.conf')" string typestr="filename" optional
option "loglevel" l "set loglevel (0-6)" int typestr="level" default="4" optional
option "timeout" t "set timeout" int typestr="milliseconds" default="30" optional
-option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc -t 100 stat" optional
+option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc stat" optional
section "mapping keys to commands"
option "key_map" k "Map key k to command c using mode m. Mode may be d, x or p for display, external and paraslash commands, respectively. Of course, this option may be given multiple times, one for each key mapping." string typestr="k:m:c" optional multiple
{
char *ret, *hn = para_hostname();
ret = make_message("%s1.0\nHost: %s\nUser-Agent: para_recv/%s\n\n\n",
- HTTP_GET_MSG, hn, VERSION);
+ HTTP_GET_MSG, hn, PACKAGE_VERSION);
free(hn);
return ret;
}
char *select_clause = NULL;
if (!streamname)
tmp = get_current_stream();
- else
+ else {
tmp = escape_str(streamname);
+ if (!tmp)
+ return NULL;
+ }
if (!strcmp(tmp, "(none)")) {
free(tmp);
if (filename) {
char *ret, *ebn = escaped_basename(filename);
+ if (!ebn)
+ return NULL;
ret = make_message("select to_days(now()) - "
"to_days(lastplayed) from data "
"where name = '%s'", ebn);
num = atoi(argv[1]);
if (!num)
return -E_MYSQL_SYNTAX;
- stream = (argc == 2)? get_current_stream() : escape_str(argv[2]);
+ if (argc == 2) {
+ stream = get_current_stream();
+ if (!stream)
+ return -E_GET_STREAM;
+ } else {
+ stream = escape_str(argv[2]);
+ if (!stream)
+ return -E_ESCAPE;
+ }
tmp = get_query(stream, NULL, 0);
+ free(stream);
+ if (!tmp)
+ return -E_GET_QUERY;
query = make_message("%s limit %d", tmp, num);
free(tmp);
- ret = -E_GET_QUERY;
- free(stream);
- if (!query)
- goto out;
ret = -E_NORESULT;
result = get_result(query);
free(query);
goto out;
send_va_buffer(fd, "new entry: %s\n", row[0]);
erow = escape_str(row[0]);
+ if (!erow)
+ goto out;
query = make_message("insert into data (name, pic_id) values "
"('%s','%s')", erow, "1");
free(erow);
tmp = get_query(stream, NULL, 1);
free(stream);
+ if (!tmp)
+ goto err_out;
query = make_message("%s limit %d", tmp, num);
free(tmp);
result = get_result(query);
goto out;
if (argc < 2)
conf.mysql_database_arg = para_strdup("paraslash");
- else
+ else {
+ ret = -E_ESCAPE;
conf.mysql_database_arg = escape_str(argv[1]);
+ if (!conf.mysql_database_arg)
+ goto out;
+ }
query = make_message("create database %s", conf.mysql_database_arg);
ret = real_query(query);
free(query);
pord->session = rtp_session_new(RTP_SESSION_RECVONLY);
PARA_NOTICE_LOG("receiving from %s:%d\n", c->host_arg, c->port_arg);
rtp_session_set_local_addr(pord->session, c->host_arg, c->port_arg);
+ rtp_session_set_remote_addr(pord->session, c->host_arg, c->port_arg);
rtp_session_set_payload_type(pord->session, PAYLOAD_AUDIO_CONTINUOUS);
if (c->jitter_compensation_arg) {
rtp_session_enable_adaptive_jitter_compensation(pord->session, TRUE);
}
}
+static int set_multicast(RtpSession *s)
+{
+ unsigned char loop = 1;
+ int ret;
+
+ ret = setsockopt(s->rtp.socket,
+ IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop));
+ if (ret < 0) {
+ PARA_ERROR_LOG("IP_MULTICAST_LOOP error %d\n", ret);
+
+ }
+ return 1;
+}
+
static void ortp_init_session(struct ortp_target *ot)
{
RtpSession *s;
if (ret < 0) {
rtp_session_destroy(ot->session);
ot->session = NULL;
+ return;
}
+ set_multicast(s);
}
/* called by afs */
int stat_line_valid(const char *);
void stat_client_write(char *msg, int itemnum);
int stat_client_add(int fd, long unsigned mask);
-void dump_empty_status(void);
unsigned for_each_line(char *, int, void (*)(char *));
+#define FOR_EACH_STAT_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
struct stat_item_data {
const char *prefix, *postfix;
void rn_event_handler(struct task *t)
{
+ struct receiver_node *rn = t->private_data;
PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-t->ret));
+ rn->eof = 1;
unregister_task(t);
}
SDL_EventState(SDL_MOUSEBUTTONUP, SDL_IGNORE);
/* Set the window manager title bar */
SDL_WM_SetCaption("The Gui of death that makes you blind (paraslash "
- VERSION ")", "SFont");
+ PACKAGE_VERSION ")", "SFont");
}
/*
*/
int main(int argc, char *argv[])
{
- int i, ret, fd;
+ int i, ret, fd = -1;
SDLKey sym;
sdl_gui_cmdline_parser(argc, argv, &args_info);
height = args_info.height_arg;
// printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
init_stat_items();
- fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
init_SDL();
for (i = 0; fonts[i].name[0]; i++) {
char buf[MAXLINE];
update_input();
}
for (;;) {
+ if (fd < 0) {
+ fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
+ if (fd < 0)
+ clean_exit(EXIT_FAILURE);
+ }
ret = draw_status(fd);
if (ret < 0) {
close(fd);
|| sym == SDLK_COMPOSE
)
continue;
- if (fd < 0) {
- kill(0, SIGINT);
- close(fd);
- }
fill_input_rect();
update_input();
if (!command_handler())
print_help();
update_pic();
SDL_UpdateRect(screen, 0, 0, 0, 0);
- fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
break;
}
}
option "height" y "Specify screen height" int typestr="pixels" default="768" optional
option "config_file" c "(default='~/.paraslash/sdl_gui.conf')" string typestr="filename" optional
option "window-id" w "(currently ignored)" string typestr="filename" optional
-option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc -t 100 stat" optional
+option "stat_cmd" s "command to read server and audiod status data from" string typestr="command" default="para_audioc stat" optional
option "pic_cmd" p "command to read pic from" string typestr="command" default="para_client pic" optional
again:
FD_ZERO(&wfds);
FD_SET(fd, &wfds);
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
ret = select(fd + 1, NULL, &wfds, NULL, &tv);
if (ret < 0 && errno == EINTR)
goto again;
[SI_AUDIOD_UPTIME] = "audiod_uptime",
[SI_SELECTOR] = "dbtool"
};
-#define FOR_EACH_STAT_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
static void dump_stat_client_list(void)
{
PARA_DEBUG_LOG("%d client(s)\n", num_clients);
}
-/**
- * send empty status list
- *
- * Send to each connected client the full status item list
- * with empty values.
- */
-void dump_empty_status(void)
-{
- int i;
-
- if (!initialized)
- return;
- FOR_EACH_STAT_ITEM(i) {
- char *tmp = make_message("%s:\n", status_item_list[i]);
- stat_client_write(tmp, i);
- free(tmp);
- }
-}
/**
* check if string is a known status item.
if (ret <= 0)
return;
*sot->loaded -= ret;
+ if (*sot->loaded)
+ memmove(sot->buf, sot->buf + ret, *sot->loaded);
t->ret = 1;
}
/**
* compute fraction of given struct timeval
*
- * \param divider the integer value to divide by
+ * \param divisor the integer value to divide by
* \param tv the timevalue to divide
* \param result holds (1 / mult) * tv upon return
*/