Commit Graph
2298 Commits
Author SHA1 Message Date
Mike Brady 9d2eb511cd Fix a variable substitution. Might be problematic for BSD 2017-11-12 16:53:55 +01:00
Mike Brady d4eae76f33 dbus-related files taken from directories and renamed 2017-11-12 15:45:29 +01:00
Mike Brady f5248a20e1 Change the names of some of the files. 2017-11-12 14:49:53 +01:00
Mike Brady e50e39a3f9 Merge branch 'development' of github.com:mikebrady/shairport-sync into development
Forgot the typo fix.
2017-11-12 14:28:02 +01:00
Mike Brady 3198ec4265 Improve dbus and add some dacp services 2017-11-12 14:26:10 +01:00
Mike Brady 532c77eb23 clang-format only 2017-11-12 14:25:09 +01:00
Mike BradyandGitHub 5e6b3382b0 Merge pull request #614 from corbinsantin/development
Fix typo in README.md
2017-11-09 09:19:59 +00:00
Corbin Santin df603dc8bc Update README.md
small typo
2017-11-09 00:15:36 -08:00
Mike Brady 827fa5a5b0 Clean up rtp_send_client_command a little 2017-11-06 09:05:22 +00:00
Mike BradyandGitHub 00dbf5aa3d Update RELEASENOTES.md 2017-11-04 12:02:39 +00:00
Mike BradyandGitHub 177992fb58 Merge pull request #612 from belboj/signal-race
Fixed race condition when stopping other threads with SIGUSR1
2017-11-04 11:43:35 +00:00
Belbo b98e6a9ac0 Fixed race condition when stopping other threads with SIGUSR1
Many threads have a main loop that checks some exit variable in the loop condition. To stop a thread, another thread sets that exit variable, sends a SIGUSR1 to that thread to get it out of blocking calls like read(), write() or select(), and finally joins it.

There was a race condition though: if the signal arrived after the loop condition was checked but before the blocking system function was entered, the target thread essentially ignored the signal, made the blocking call anyway, and could get stuck forever there.

The only way around this race condition is to block SIGUSR1 in the destination thread during the critical time interval. This requires that the blocking system call and the call to unblock SIGUSR1 be an atomic unit. There is only one system call that makes this possible: pselect(), which takes a signal mask to replace the current signal mask with, but only while pselect() runs. Other functions like read(), recv(), write() and sendto() may only be called if we can be sure that they don't block. For this purpose, the file descriptors must be set to non-blocking mode and we must prepend the call to them with a call to pselect() to block until the socket becomes readable/writable.
2017-11-01 20:46:05 +01:00
Mike BradyandGitHub 183c6f08e0 Update RELEASENOTES.md 2017-11-01 15:56:59 +00:00
Mike BradyandGitHub 889bae4d3e Merge pull request #611 from belboj/some-fixes
Some issues found during the development of a DLNA backend.

Many thanks for these.
2017-11-01 15:49:37 +00:00
Belbo 3e54765193 Fixed loop condition in non_blocking_write()
The while loop should be repeated, if the last write attempt was a partial write only. In this case, however, rc is greater than 0 (should be 1), not equal to 0.
2017-10-31 23:19:22 +01:00
Belbo afa3238829 Fixed EINTR handling in rtsp_read_request()
EINTR is an error code written to errno, not returned by read().
2017-10-31 23:19:22 +01:00
Belbo 39e122a4ff Fixed dangling pointer to random state array
The C library function initstate(), at least in macOS El Capitan, not only sets the state array given to it as the second argument, but also accesses the state array given to it in a previous call! (I don't know why, or if that behaviour is correct, but macOS seems to do that anyhow).
Therefore, we cannot pass a local variable to it. As soon as the player thread stops, it will be a dangling pointer, and when a new player thread is started afterwards, initstate() will dereference that dangling pointer with unforeseeable consequences.
2017-10-31 23:19:22 +01:00
Belbo a704b2fe0b handle_announce() waits for playing_conn to stop if it's already shutting down
- If playing_conn is already stopping, handle_announce() waits one second for it to stop. This gives the current RTSP connection a better chance to get the player, if it has been started very quickly after the previous RTSP connection had decided to stop. iTunes can sometimes be very quick in starting a new RTSP connection after tearing down the previous one, but shairport_sync unfortunately needs at least 100ms to shut down the old connection.
- cleanup_threads() sets playing_conn to NULL if it points to the removed thread, otherwise playing_conn would be a dangling pointer, which is bad, because handle_announce() dereferences it unless it is NULL.
2017-10-31 23:19:22 +01:00
Belbo 19ff6042cf Prevent buffer overflow in log functions
die(), warn(), debug() and inform() write the string into a limited internal buffer first. They now use vsnprintf() instead of vsprintf() to prevent an overflow of that buffer.
2017-10-31 23:19:21 +01:00
Mike BradyandGitHub 9f2acec154 Update RELEASENOTES.md 2017-10-30 09:49:20 +00:00
Mike Brady d46172e2eb Don't disable PulseAudio autospawn 2017-10-30 10:45:38 +01:00
Mike Brady 5fba88cd60 Add an exit diagnostic, clean up a dbus flag 2017-10-30 10:37:34 +01:00
Mike Brady 91c6587d78 Address a warning about a buffer being too short. 2017-10-25 19:31:10 +01:00
Mike Brady d406514966 Correct a few warnings that show upo in Clang but not in GCC 2017-10-24 10:30:20 +01:00
Mike Brady 588c551bae Correct a Makefile bug that was silent in Linux but caused problems in FreeBSD 2017-10-24 10:29:43 +01:00
Mike BradyandGitHub 7389ea8099 Update RELEASENOTES.md 2017-10-22 10:23:48 +01:00
Mike Brady 6467803858 Adjust the debug level of buffers exhausted and network condition messages. 2017-10-22 11:20:21 +02:00
Mike Brady 338831455b Oops -- a little typo. 2017-10-15 14:38:52 +01:00
Mike BradyandGitHub d3241cfeaf Update RELEASENOTES.md 2017-10-15 14:29:33 +01:00
Mike BradyandGitHub f27f4db9b6 Update RELEASENOTES.md 2017-10-15 14:29:04 +01:00
Mike Brady 90874ea6f8 Merge branch 'development' of https://github.com/mikebrady/shairport-sync into development
Oops.
2017-10-15 14:24:14 +01:00
Mike Brady 3cb86f400b Add the 'dapo' metadata message, giving the DACP port number when found 2017-10-15 14:23:09 +01:00
Mike Brady 415b3f4ba9 Generalise volumeup to any command. 2017-10-15 13:08:21 +01:00
Mike BradyandGitHub ca29610722 Update RELEASENOTES.md 2017-10-13 22:24:06 +01:00
Mike Brady b3a90f9d6d Make the volumeup command work with IPv6 -- use the scope_id 2017-10-13 22:16:50 +01:00
Mike Brady ce06d45033 Hook up "volumeup" remote control command -- doesn't work on ipv6, it seems 2017-10-09 22:14:34 +01:00
Mike Brady c3bfb048ca Checnk the order of the commands a little 2017-10-09 11:02:54 +01:00
Mike Brady 687213e1f0 Use the DESTDIR variable to make packaging easier 2017-10-09 11:02:25 +01:00
Mike Brady 6f8bd1a6e5 Bump to indicate cleanup of configuration files and fixup of installation for dbus stuff. 2017-10-09 10:47:17 +01:00
Mike Brady 7f1b06ae16 Don't need it any more. 2017-10-09 10:46:10 +01:00
Mike Brady c81ec87dc5 Add in code to install the xml file in the local interfaces directory 2017-10-09 10:44:47 +01:00
Mike Brady fe51dce110 Stop using the DBUS_SERVICES_DIR stuff 2017-10-09 10:43:48 +01:00
Mike Brady 3da6f449d1 Remove the need for the AS_AC_EXPAND macro and remove the m4 subdirectory containing it 2017-10-09 10:40:12 +01:00
Mike Brady eec0420a27 Tighten up the ownership policy 2017-10-09 10:38:47 +01:00
Mike Brady 1e0d0944c0 Tidy up configure.ac and drop old pulseaudio back end 2017-10-09 09:38:35 +01:00
Mike Brady 578981887e A little experimentation with dbus 2017-10-07 20:49:32 +01:00
Mike Brady d343a851c0 Some spring cleaning using clang-format 2017-10-05 17:48:24 +01:00
Mike Brady 87bf5e87ac Add avahi code to look for the rmeote control information for the client and get the port number from it. 2017-10-05 17:40:51 +01:00
Mike Brady 139c18bf3e Add avahi code to look for the rmeote control information for the client and get the port number from it. 2017-10-05 17:39:32 +01:00
Mike BradyandGitHub 44c39fee6a Update README.md 2017-10-02 11:22:04 +01:00