Andre Noll [Sat, 16 Feb 2008 14:33:50 +0000 (15:33 +0100)]
Sender code consolidation, on/off commands for the dccp sender.
This patch moves a bunch of code from the http sender to
send_common.c to make it available also for the dccp sender.
To this aim a new structure sender_status is introduced which
holds the configuration and the current status of the http/dccp
sender. Most of the new functions in send_common.c take a pointer
to such a structure.
This allows to implement the off/on/allow/deny/info commands
as a one-liner for both the dccp and the http sender.
The new server config option dccp_max_clients allows to restrict the
number of simultaneous connections to the dccp sender.
Andre Noll [Sun, 10 Feb 2008 11:49:29 +0000 (12:49 +0100)]
Speed up open_current_receiver().
To my surprise, this function showed up in the profiling info.
This is due to the fact that the old code was parsing the
FORMAT status item in audiod_pre_select() which gets called
on each iteration of the sheduler. However, this status item
gets only modified on audio file change.
So parse the status item string only once, when we receive it,
and store the current audio format number in the new field of
struct status_task.
Andre Noll [Sat, 9 Feb 2008 19:32:36 +0000 (20:32 +0100)]
compress.c: Simplify volume adjusting code.
There's no need to distinguish the cases sample > 0 and
sample < 0. Work with its absolute value instead and get
rid of some similar code in the hot path.
Andre Noll [Mon, 4 Feb 2008 19:41:00 +0000 (20:41 +0100)]
http_send.c: Fix a bug in http_post_select().
If the accept() on the listen_fd fails, we don't have a valid
file descriptor but tried to close it anyway. Even worse, the
old code dereferenced and then freed the "sc" pointer which
isn't inititialized at that point.
Andre Noll [Sat, 2 Feb 2008 20:28:51 +0000 (21:28 +0100)]
Intoduce send_common.c and use it from the dccp sender.
This new file contains code that was identical for the
dccp and the http sender. A subsequent patch will convert
the http sender to also use the shared code in send_common.c
Andre Noll [Sat, 2 Feb 2008 11:20:22 +0000 (12:20 +0100)]
dccp_send.c: Fix a header sending bug.
If the dccp sender is asked to send out an empty chunk, it
returns immediately without doing anything. However, we
might want to send the audio file header or the queued chunks
in this case. So always loop over all connected clients to see
if we can send something.
Moreover, if we are not listending on the dccp port, there can
not be any dccp clients, so the loop over all clients will be
an empty loop. Thus we may skip the initial check for an early
return completely.
Andre Noll [Sat, 2 Feb 2008 10:50:42 +0000 (11:50 +0100)]
http_send.c: Get rid of HTTP_READY_TO_STREAM.
The only reason for this state was to know whether we
already sent the audio file header. Store this info in
the new header_sent member of struct http_client.
This simplifies the code a bit and makes it more similar
to the dccp sending code.
Andre Noll [Mon, 21 Jan 2008 08:24:16 +0000 (09:24 +0100)]
Be more careful on command exit.
If the callback returned zero, there's nothing to do.
If it returned positive, we have to send out the result
buffer and must free it afterwards. Sending the buffer may
well lead to an error condition, so always check the return
value of the corresponding call to send_buffer(). Finally,
it the command handler returned a negative value, we have
to send an error message to the client which might give rise
to another error (if sending the errror message failed). In this
case, ignore the send errror and return the previous error value.
Andre Noll [Sat, 19 Jan 2008 11:57:59 +0000 (12:57 +0100)]
Get rid of sender->status.
DRY: For the http and the dccp sender, the status is given by
the value of the listening fd. For the ortp sender, introduce
the new static int sender_status.
Andre Noll [Thu, 17 Jan 2008 20:50:20 +0000 (21:50 +0100)]
vcc.c: Fix a memory leak in recv_afs_result().
This function contained a code path that allocated
the buffer for the chunk table and then returned an error
(due to a failing fstat()) without freeing the chunk table
buffer.
Andre Noll [Thu, 17 Jan 2008 20:40:38 +0000 (21:40 +0100)]
net.c: Fix a memory leak in makesock().
"port" was allocated dynamically but never freed. Fix it by
using a static buffer instead. This buffer can not overflow as
"port_number" is an unsigned short, so its decimal representation
consists of at most 5 digits.
Andre Noll [Fri, 11 Jan 2008 13:15:41 +0000 (14:15 +0100)]
Remove man pages from tarball.
Since they are re-created at make install time anyway and help2man
is now considered a required tool for building paraslash, there is
no reason to ship the pre-generated man pages with the tarball. This
reduces the size of the tarball by about 2k.
Thanks to Johannes Wörner for pointing out this inconsistency.