evbuffer_read() is really meant to read from sockets and not regular
files. It also looks like evbuffer_read() was causing issues with large
files, locking up a little below 2 GB for an unknown reason (couldn't
reproduce).
Try to be a bit more strict about integer types, use off_t or int64_t for
file size and file offsets.
Replace safe_ato*() by safe_atoi32() and safe_atoi64(), fix integer types
at call sites to match.
Hinting the OS about our behaviour shouldn't make a big difference in
performance but it will help the OS manage its disk cache and can reduce
memory pressure on small systems.
DAAP queries from Remote won't need HTTP authentication as they all
require a valid session-id; Remote can only obtain a valid session-id
if its pairing-guid is known to us (it did pair successfully with us).
Stock evhttp has no means to detect when an incoming connection gets
closed by the client; it will notice the connection has gone down only
when sending back a reply.
For DAAP update requests working as a push mechanism with an HTTP request
stalled by the server until there actually is an update available, we need
to be notified when a connection goes down so we can perform proper cleanup
and not retain memory.
Do so by extending the close detection mechanism used for outgoing connections
and the connection failure callback we already have in place for streaming.
Get rid of strlcpy() and its implementation entirely, it doesn't buy anything
over snprintf(). Use evutil_snprintf() so as to match the rest of the code.
media_kind=2 (Movies) indicates a regular video, that is, a video that
isn't a TV Show (media_kind=64).
Also fix up the system playlist for Movies, and that brings us to DB
schema_version 5.
The filescanner dereferences symlinks as it encounters them, but it did
not dereference the top-level library directories given in the config.
Also the playlist scanner always dereferences the filenames.
As a result, there was a mismatch between the paths in the files table and
the paths in the playlistitems table if the library directory given in the
config contain a symlink somewhere along the way.