| Commit message (Collapse) | Author | Age |
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Improvements for the virtual streaming system
---------------------------------------------
This brings in a bunch of small improvements and a fix for a SIGHUP related bug.
* t/vss:
vss: Streamline vss_post_monitor().
vss: Run sender commands first in vss_post_monitor().
vss: Set mmd->offset early when paused.
vss: Don't set data send barrier unnecessarily.
vss: Improve documentation of --autoplay-delay.
vss: Open-code fc_num_redundant_slices().
vss: Check return value of compute_slice_size().
vss: Clarify afs socket handling.
vss: Handle EOF *after* sending chunks.
vss: Merge vss_compute_timeout() into its caller.
vss: Kill magic 100ms timeout.
vss: Remove vss_chunk_time().
vss: Simplify and rename recv_afs_msg().
vss: Recompute announce timeval on SIGHUP.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The hup subcommand does not work as expected when the argument to the
--announce-time has changed in the configuration file. The problem is that
we convert the argument once to a struct timeval in vss_init() and only use
that for everything, but miss to update the struct on SIGHUP.
Fix that by adding a ms2tv() call to handle_sighup(). To give this function
access to the struct, we need to move it from struct vss_task to server.c,
make it non-static and declare it in server.h.
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now create a per-command socket pair in the command handler and use the
permanent server-afs socket to pass one end of the pair from the command
handler to the afs process.
With this approach only the command handlers can possibly talk to the
afs process, so we don't need to worry about malicious or bogus connections
arriving at the local socket.
Consequently, we may remove the socket cookie and employ blocking I/O for the
shared memory identifiers that are transferred through the per-command socket.
Connections are now dispatched in one go, obviating the need to keep track
of connected clients. So remove struct afs_client and the client list.
|
| |
|
|
|
|
|
|
| |
Generated with
sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h
followed by manually tweaking the result a bit. No license change intended.
|
| |
|
|
|
| |
The text was a bit clumsy, and it talked about mmd_{un,}lock(), which have
long been superseded by mutex_{un,}lock().
|
| |
|
|
|
|
| |
This works because only the server links with user_list.o. Since struct user
contains a list head, list.h must now be included *before* server.h, which
requires some trivial header shuffling in the .c files that include server.h.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
With dccp gone, almost everything of send_common.c is specific to the
http sender. The only exception is parse_fec_url(), which is called from
com_sender() of command.c and from udp_send.c. Move this function
to server.c and the rest to http_send.c. Make the latter static and
dedoxify them.
The generic_ function prefix indicates that the function works for both the
http and the dccp transport. With dccp gone, this has become meaningless. We
keep the prefix, though, to keep the patch small.
|
| |
|
|
|
|
|
|
| |
Two of the four functions exposed in close_on_fork.h are only called from
server.c, the other two from the senders. The former two can now be made
static. Since both were implemented as one-line wrappers of the static
deplete_cof_list(), we keep only that, remove the wrappers and adjust the
two callers.
|
| |
|
|
|
|
| |
It's unused since 2008.
Fixes: 09effd7848b2151068a4cc4b4c4c7a0b49e05e6d
|
| |
|
|
|
|
|
| |
The last caller was removed when the tasks server subcommand was disabled
eight years ago.
Fixes: bb91597b9ecf650a63a40753f7f7c771576d252e
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes use of the infrastructure introduced in the previous patch.
However, the implementation of the ll command for para_server is more
involved than its audiod counterpart because in the server case we
have to tell two different processes (server and afs) to change their
log level while the calling process, the command handler, does not
need to set the loglevel because it is about to exit anyway.
For the inter-process communication we introduce a new field in the
mmd shared memory area so that command handlers can read the current
value or set a new value. The log level propagates from there via
daemon_set_loglevel() to the server and afs processes during each
iteration of the scheduler loop where para_log() will pick it up to
set the log level threshold for subsequent log events.
The si command handler currently refers to the argument of the
--loglevel server option to include the log level in its output. With
dynamic log levels this no longer works because it always prints the
value from the command line or the config file rather than the run
time log level. Since the new ll command also prints the loglevel
when it is executed with no arguments, we simply remove this line
from the si output and hope that nobody cares.
The si command handler was the last user of the ENUM_STRING_VAL macro
in command.c. Removing the macro also allows us to make CMD_PTR local
to server.c and to remove the lopsub definitions of the server suite
from command.c. However, we still include the lopsub definitions of
the server *command* suite (server_cmd.lsg.h) of course.
We let any authenticated user run the command with no arguments to
report the current loglevel but require full privileges to change
the loglevel. Thus, the check for sufficient privileges needs to be
performed in the command handler.
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This series removes many memory leaks of para_server by refactoring
the shutdown and signal handling code. Most of the leaks happen only
at shutdown and are hence harmless. But it is still good to plug
the leaks because this puts more focus on real memory leaks in the
valgrind output.
The merge conflicted rather badly due to the changes introduced with
the crypt branch that was merged last week. The resolution has been
thoroughly tested, though.
* refs/heads/t/clean_server_exit: (32 commits)
command.c: Document return value of handle_connect().
user_list: Make list head static.
afs: Allow database switching on sighup.
afs: Free current mood or playlist on exit.
afs: Free status items on exit.
afs: Shutdown signals on exit.
server: Free parse result also in afs.
afs: Deplete user list at startup.
server: Free audio file header on exit.
sender: Deplete ACLs on exit.
Remove some unused includes from {dccp,http}_send.c.
server: Make argument of user_list_init() constant.
server: Deplete user list on exit.
server: Combine user_list_init() and populate().
server: Move para_fgets() to user_list.c.
server: Initialize user list at compile time.
server: Rename functions related to user lists.
server: Constify return value of lookup_user().
server: Let stat command handler perform cleanup on signals.
server: Have afs process close the current mood on exit().
...
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Both the server and the afs process need to access the lopsub parse
result which is allocated and initialized prior to the fork(2) that
creates the afs process. Hence both processes should free this memory
on exit.
The new public free_lpr() frees the memory allocated by both parse result
structures.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This introduces ->shutdown for struct sender. Each of the three senders
implements the new method to close file descriptors and to deallocate
the resources occupied by the sender. The method is only called on
exit via the new vss_shutdown() from both server and command handler
context after schedule() returns.
We need to introduce another helper, process_is_command_handler(), to
distinguish between the two callers.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently the command handlers are called from the ->post_select
method of the command task after the main server process has forked.
When the command handler is done, it exits with the scheduler still
active. This is not a problem per se, and it has been like this
for more than a decade, but it does make it harder to debug memory
leaks because we leak some resources. Valgrind complains about this,
cluttering the output with pointless warnings.
This commit cleans up the memory handling of the child process on
exit. The command task of the child process notifies all tasks in its
->post_select method and then returns the new pseudo error code
-E_CHILD_CONTEXT. This causes the scheduler to return to main().
The main() function checks via the new ->child_fd of struct
server_command_task whether it is running in child context after
schedule() has returned and calls the command handler in this case.
|
| |/
|
|
|
|
| |
This generic networking-related constant does not belong to
server.h. However, since server.h uses the constant, we have to make
sure that net.h is included before server.h.
|
| |
|
|
|
|
| |
The afs_pid variable is read-only after it has been initialized. Hence
it does not qualify for being part of the shared memory area which
contains the mmd struct. Make it a global variable instead.
|
| |
|
|
|
|
| |
The only reason we pass it is that handle_connect() can print a
log message containing the peer name. However, we already log this
information right after the connection was accepted.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The GPLv2 line does not add any additional information, so drop
it. This leaves a single line of legalese text for most files, which
is about the amount of screen real estate it deserves.
This patch was created with the following script (plus some manual
fixups):
awk '{
if (NR <= 5) {
gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g")
if (gs != $0)
year = gs
next
}
if (NR == 6 && year != "")
printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year)
print
}'
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The bulk of the changes in this release is the conversion of all
command line parsers from gengetopt to lopsub.
The series also contains a few cleanups that have become possible
due to the switch from gengetopt to lopsub.
The patches towards the end of the series rename para_fade to
para_mixer.
Naturally, the merge conflicted rather heavily against the other
topic branches that have been merged since the lopsub branch was
started. Conflicting files:
Makefile.real afh.c afh_recv.c configure.ac osx_write.c write.c
The resolutions for these conflicts were recorded with git rerere
and have been tested for quite some time.
Cooking for three weeks.
* refs/heads/t/lopsub: (74 commits)
audioc: Avoid double free in audioc_i9e_line_handler().
audiod: Avoid uninitialized memory access.
Simplify mixer setup.
mixer: Implement non-linear time scale for fading.
mixer: Allow arbitrary relative time for sleep subcommand.
Convert para_fade to subcommands, rename it to para_mixer.
build: Create .dep files only during compilation.
build: Simplify definition of $m4_lls_deps.
build: Rename command list variables.
build: Combine $(CFLAGS) and $(STRICT_CFLAGS).
build: Let .d files depend only on .c.
build: Don't create phony targets for dependencies.
build: Remove duplicate dependency.
build: Remove cmdline_dir and friends.
build: Remove some unused variables from Makefile.real.
build: Remove m4/gengetopt.
Remove gengetopt and help2man checks from configure.ac.
Remove man_util.bash.
Remove ggo.c and ggo.h.
manual: Do not mention gengetopt and help2man any more.
...
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is the last executable to be converted to lopsub.
acl_init() is removed from acl.c, and the initialization of the access
control list is moved to init_sender_status() of send_common.c. It
now takes an lls_opt_result argument and calls acl_add_entry() for
each argument given. The latter function needs to be made public.
In dccp_send.c we check the FEC parameters and change the gengetopt
config structure to contain the default values if invalid FEC
parameters were given. With lopsub this is no longer possible as
the lls_parse_result structure is opaque. We copy the FEC parameters
to a dccp_fec_client structure anyway, so is it easiest to move the
check there.
The patch removes the unused gengetopt option files but leaves the
gengetopt infrastructure of the build system in place. The build
system will be cleaned up in subsequent patches.
|
| |/
|
|
|
|
|
|
|
|
|
| |
This field stores the size of the memory mapping of the current audio
file, if any. No command handler ever changes the value, and the
value is not read from com_stat(), so there is no reason for ->size
to be part of the mmd shared memory area.
Unlike ->size, the pointer to the mapping is stored in struct vss_task.
Given that vss.c is the only file which reads ->map or ->size, it
makes sense to store both values together in the vss task struct.
|
| |
|
|
|
|
|
| |
This adds a sentence to the description of the structure which explains
how the misc_meta_data structure is used for communication betweeen
the server process and the command handlers. The patch also contains
some minor language improvements.
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Cooking in next for four weeks.
* aft: Store resolved paths when adding files.
* aft: Update mtime and file size on afhi changes.
* aft: Update status items on afs events.
* aft.c: Pass struct ls_data pointer to make_status_items().
* afs: Simplify open_next_audio_file().
Conflicts:
aft.c
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If the current audio file is re-added to the osl database, for example
because meta tags have changed, file size and modification time change.
However, the paraslash stat command still shows the old values because
currently the virtual streaming system calls fstat(2) only once when
the audio file is opened and keeps reporting the resulting mtime and
file size values until the file is closed.
This commit introduces make_inode_status_items() which is called
from make_status_items() on AFSI_CHANGE and AFHI_CHANGE events for
the current audio file. The new function calls stat(2) on the path
obtained from the current aft row. We can't use fstat(2) since (a)
we don't have an open file descriptor any more and (b) this would
not work anyway if the original file was overwritten.
Due to the new helper, mmd->mtime can be removed. We must keep
mmd->size though, since we need the original file size for the call
to munmap().
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Done with
files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll')
sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files
In previous years we ran a similar script to set the second year in
the range to the current year. This is kind of silly, so let's get
rid of this useless information.
This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in
all file headers, i.e. only the first year (A) is left in. Accurate
information including time stamps for each change can be obtained
from the git history.
|
| |
|
|
|
|
| |
It is sometimes useful to see the task list of para_server. The
infrastructure for obtaining this information is already in sched.c,
so this is a rather simple matter.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The mail server on systemlinux.org was down for more than a week
lately, so let's use an alternative official address. This commit
changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de.
Most .c and .h files contain the email address in the copyright header,
so they must all be patched. Three other files contain the address
for a different reason:
* README lists email and git, gitweb and home page URLs
* configure.ac needs it for configure -h
* version.c contains it for the -V option of all commands
|
| |
|
|
|
|
|
|
|
| |
This year, we're really on time. The changes in this patch were
created by the following silly script:
files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll')
sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files
sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
|
| |
|
|
| |
Better late than never.
|
| | |
|
| | |
|
| |
|
|
| |
Hey, this is earlier than last year :)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old code used a rather fancy way to (de)activate encryption on
a per fd basis: In net.c there was an array of rc4 keys, indexed by fd.
This is rather wastful because the array size is determined by the
highest fd for which encryption is activated.
It's also hard to comprehend and it's easy to get strange results if
one forgets to deactivate the encryption after the fd is closed.
This patch introduces a new structure, rc4_context, which consists of
an fd and the needed rc4 keys. Users explicitly call the new rc4 variants
of the receving/sending functions which take a pointer to a struct
rc4_context instead of a file descriptor but are otherwise identical.
Keep crypt simple!
|
| |
|
|
|
|
|
| |
This patch allows to specify the fec parameters in the add subcommand
like this:
para_client sender udp add 224.0.1.38:8000/1400:63:64
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for URL strings to support IPv4/IPv6 addresses, hostnames,
and optional port numbers to the UDP sender. The syntax is based on RFC 3986,
example URL strings to be used with the 'add'/'delete' commands are:
10.10.1.2:8000 # host:port
10.10.1.2 # host with default port 8000
localhost # hostname (for IPv4 or IPv6 host)
localhost:8001 # hostname with port
[::1]:8000 # same, but different syntax
[badc0de::1] # IPv6 host with default port 8000
The 'delete' command now also supports port-wildcarding, i.e. not specifying
the port in the 'delete' command removes all targets whose host names match.
The UDP sender has been tested to function with IPv6, including multicasting:
* server: para_server --udp_target=[ff05::beef]:8000 --udp_mcast_iface=eth1
* client: para_audiod -F -D -r 'ogg:udp -i ff05::beef -I eth0'
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ACL subsystem performs access validation based on IPv4 address /
netmask pairs. Since the internals of this system are exposed via
struct sender_command_data, other subsystems can only use IPv4.
This patch migrates the IPv4-specific parts of the ACL subsystem inside
that system and replaces the 'struct in_addr' address with a host
string. A subsequent patch converts the remaining subsystems to also
use strings instead of AF-dependent addresses.
For the present purpose the string size (fixed) is over-dimensioned,
since a valid IPv4 address contains at most 15 = 4*3 + 3 + 1 bytes
(including the 3 dots and the '\0'). The size should also be sufficient
for hostnames, since RFC 1123, 2.1 suggests a maximum length of 255.
Since the conversion string -> struct in_addr now happens later,
syntax checks have been added for argument strings.
|
| |
|
|
|
| |
Make afs also reload the config file and reopen its log file. The old
code did not honor for example loglevel changes.
|
| | |
|
| |
|
|
|
| |
Replace mmd->server_pid by mmd->afs_pid because everybody
can easily find out the server pid.
|
| |
|
|
|
|
| |
They were only wrappers for mutex_lock() and mutex_unlock().
So export the lock, use mutex_lock() and mutex_unlock()
everywhere and remove the wrappers.
|
| | |
|
| |
|
|
|
| |
Also make listen_fd global, and annotate handle_connect() with
__noreturn.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This converts the control connection and the HTTP streaming module to use the makesock() interface.
The specific changes are:
* replace tcp_connect() directly with makesock();
* replace tcp_listen() with para_listen() (in turn a wrapper around makesock());
* init_sockaddr() becomes obsolete;
* replaced use of sockaddr_in in para_accept() with NULL sockaddr argument
-- the `remote' name of the socket is always available via getpeername(2),
-- this is exploited by replacing the reverse-name lookup with remote_name();
* the sockaddr_in field `addr' of `struct http_client' has been replaced with `name' string
-- name is filled in as in para_accept() above, using remote_name(),
-- unlike above, the remote_fd() call can later not be done, due to close_listed_fds().
The one thing I am really not sure about is host_in_access_perm_list():
* It needed to be converted to allow address-independent HTTP streaming.
* The conversion represents the obvious choice for doing this.
* However, I have not (yet) tested it.
* A problem that may arise is that when listening using AF_UNSPEC then _all_ addresses appear
as IPv6 addresses (i.e. the test "family == AF_INET" would never hold true). In this case,
a possible solution is to switch between AF_UNSPEC and AF_INET dependint on whether the
configurable access-list is empty or non-empty, respectively.
* A possible place for this chance would be http_send_init() or any other function calling
open_tcp_port().
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
The info is also contained in afd, but this was a pointer to data in
the shared memory area. We must copy into the static mmd buffer anyway,
since com_stat() must be able to see it. So make afd.path a static
array rather than a pointer and use afd->path instead of mmd->filename.
This simplifies save_afd() and load_afd() a bit since now only the
chunk table is of variable length.
|
| |
|
|
| |
There are no more selectors to choose. It's all handled by afs.
|
| |
|
|
|
|
|
|
| |
The current audio format is also stored in mmd->afd.afsi.audio_format_id,
so use the value stored there. However, most users of mmd->audio_format
used this value only to detect whether an audio file is open ATM. In
vss.c, use the map pointer instead to find out whether an audio file is
open.
|