Andre Noll [Fri, 14 Sep 2007 09:14:41 +0000 (11:14 +0200)]
rc4: Round up output buffer size.
valgrind indicated that RC4() writes beyond the end of the output buffer which
was was of the same size than the input buffer. Workaround this by rounding up
the output buffer size to a multiple of 8.
Andre Noll [Thu, 13 Sep 2007 19:55:46 +0000 (21:55 +0200)]
Fix com_add segfault.
We call free(obj.data) unconditionally on errors, but is is not set to NULL.
Also, return always success in add_one_audio_file() in order to continue the
loop.
Andre Noll [Thu, 13 Sep 2007 19:53:32 +0000 (21:53 +0200)]
ogg_afh.c: Fix a memory leak.
In an non-ogg file is passed to the ogg audio format handler, such that the
initial ogg_sync_pageout() fails, the old code leaked the memory which was
allocated for the stream_in and the stream_out pointers.
Andre Noll [Wed, 12 Sep 2007 21:43:16 +0000 (23:43 +0200)]
aft.c: Fix com_add().
callbacks shall return zero or negative, if no result is provided. So let
com_ls_callback() return zero if no match was found, or if the audio file table
does not contain any entries. Check for ret > 0 in com_add() instead of ret >=
0, i.e. don't use the result pointer if ret is zero.
Andre Noll [Mon, 10 Sep 2007 19:52:00 +0000 (21:52 +0200)]
afs: Replace DATABASE_DIR by a runtime config option.
Also, split afs_init() into two parts: The new open_afs_tables() that
does what its name suggests and the remaining part that initializes
the scheduler.
Andre Noll [Mon, 10 Sep 2007 00:05:15 +0000 (02:05 +0200)]
afs com_add(): Recognize also audio formats different from mp3.
This required adding two more callbacks: path_brother_callback() and
hash_sister_callback(). These are called from add_one_audio_file()
which runs from handler context and can thus not access the database
directly.
Andre Noll [Sat, 8 Sep 2007 23:17:50 +0000 (01:17 +0200)]
Make afs commands work.
This required a rewrite of send_callback_request().
The patch also includes the rename of get_socket() to get_stream_socket()
which takes the new domain parameter, so that it may be used for both
AF_INET and AF_UNIX sockets.
Andre Noll [Sat, 8 Sep 2007 19:50:57 +0000 (21:50 +0200)]
Introduce template commands for command_util.sh.
And use them to produce afs_command_list.[ch] which also contains all
blob commands without duplicating all the common information in the
new afs.cmd file.
Change para_server's help command to display the new commands. These
are not yet working because the callback code is not yet functional.
Andre Noll [Tue, 4 Sep 2007 20:16:06 +0000 (22:16 +0200)]
audiod: Fix a memory leak.
If the config file doesn't exist, configfile_exists() returnes NULL.
The old code leaked a pointer to the config file in this case.
This function is only called once at startup, so the leak is benign.
Morover, kill the static variable and the check if (!config_file) which
is always true.
Andre Noll [Sun, 12 Aug 2007 21:26:27 +0000 (23:26 +0200)]
dccp_send.c: Implement chunk queuing for dccp.
As Gerrit mentioned, it might be a good idea to use chunk
queueing also for dccp. This patch uses the new cq_xxx()
abstractions in the same way as the http sender.
Andre Noll [Sun, 12 Aug 2007 16:36:53 +0000 (18:36 +0200)]
Abstract out chunk_queue code.
This moves the chunk handling code to separate functions cq_foo(). They
take pointers to a chunk queue, which makes them orthogonal to the rest of
http_send.c.
Andre Noll [Wed, 8 Aug 2007 22:00:45 +0000 (00:00 +0200)]
Rewrite chunk queueing.
Since paraslash-0.2.16 the audio file is mmapped, so it is no longer neccessary
to make a copy of the chunk data in case a chunk can not be sent immediately
because the write would block. Just remember the chunk number and the number of
bytes of that chunk which were sent (non-zero in case of short writes).
The chunk data can then be retrieved by the new vss_get_chunk() function.
Andre Noll [Mon, 6 Aug 2007 14:09:28 +0000 (16:09 +0200)]
dccp sender: Keep polling until an entry becomes free (Gerrit Renker).
If write() on the dccp fd fails with EAGAIN, the current code retries
100 times and then gives up, returning -E_DCCP_WRITE which causes a
shutdown of the dccp connection.
CCID3 has a sending wait queue which fills up and is emptied
asynchronously. The EAGAIN case means that there is currently no space
in the wait queue, but this can change at any moment and is thus not
an error condition. So keep polling until an entry becomes free.
Andre Noll [Sat, 7 Jul 2007 17:11:45 +0000 (19:11 +0200)]
mysql_selector.c: introduce the myslq lock
This fixes a race condition in para_server:
parent child
real_query
real_query
mysql_store_result
This could cause para_server to hang in case the child process issued
a query which does not yield a result. It's hard to hit though. Fix is
to take the lock before the call to real_query, and release it after
mysql_store_result().
The patch also fixes a format string bug which was introduced by the patch
that switched to my_ulonglong for suitable variables in mysql_selector.c.
These need "%lli".
Andre Noll [Sun, 10 Jun 2007 23:45:51 +0000 (01:45 +0200)]
clean up error.h
It contained quite some unused error codes. This patch gets rid of
them and thus saves some space in the resulting binaries.
More importantly, there were two instances where a source file used
an error value of another source file (which is ok), but the object
file of that other source file would not get linked into the resulting
binary (which is not ok):
- aac_afh.c used E_AACDEC_INIT, which is not contained in
para_server
- http_recv.c used E_OVERRUN which is defined only if ortp
support was compiled in.
The patch also fixes another bug in the ogg vorbis audio format handler
where (the positive value) E_STREAM_PAGEIN was returned instead of
-E_STREAM_PAGEIN in case ogg_stream_pagein() failed.