Andre Noll [Sat, 15 Sep 2007 17:42:29 +0000 (19:42 +0200)]
replace para_connect() by PARA_CONNECT.
PARA_CONNECT is a macro which works for all three socket address types
used in paraslash (sockaddr_in, sockaddr, sockaddr_un) and which does
not need a length parameter.
Change all instances of connect() and para_connect() to use PARA_CONNECT().
Andre Noll [Sat, 15 Sep 2007 07:50:14 +0000 (09:50 +0200)]
Fix the privious assertion().
It's OK to ask for the name of an audio format id < 0, as id -1 is used for
"currently no audio file is open". So allow this case, and fix the upper bound
which was off by one while we're at it.
Andre Noll [Sat, 15 Sep 2007 07:39:18 +0000 (09:39 +0200)]
audio_format_name(): Add an assert().
The paraslash code should never request the name of an audio format
with invalid id. Introduce the ARRAY_SIZE macro to get the proper
upper bound for the number of supported audio formats.
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.