Commit Graph

57 Commits

Author SHA1 Message Date
Alexandre Ratchov 285eafeec0 Add affinity between the program and its mixer control.
Currently, if there are two instances of the same program, sndiod will
allocate one volume control to each. If both programs disconnect and
reconnect, the information of which control is assigned to which
program is lost. This makes difficult to run two instances of a player
and crossfade between each other with a MIDI controller.

To address this, the program chooses a 32-bit "id" (for now the
process pid) and sends it to the server. The server records the id in
the client's slot structure.  When the server accepts a new
connection, it uses the id to identify the slot the client used during
the previous connection; if it was not recycled yet, it's assigned to
the program.
2019-07-12 08:31:01 +02:00
Alexandre Ratchov 934e1611e8 Check return values of syscalls against -1, from deraadt@. 2019-07-01 09:20:22 +02:00
Alexandre Ratchov 6ac10f167b Wait until the server disconnects before closing the socket.
When the socket is closed, the last bytes written may be lost.
2019-03-28 08:13:59 +01:00
Alexandre Ratchov d4048a3a19 Use _sndio_parsenum() to parse device numbers. From miko@. 2018-09-26 13:45:23 +02:00
Alexandre Ratchov 8018db24a0 libsndio: move ~/.aucat_cookie to ~/.sndio/cookie 2018-07-27 15:41:04 +02:00
Alexandre Ratchov 3d6b602fe9 use /dev/urandom by default 2017-11-11 13:04:46 +01:00
Alexandre Ratchov 053efb5710 no need to check if pointer passed to free() is NULL 2017-11-04 10:38:01 +01:00
Alexandre Ratchov f49f0ccd14 remove socket_cloexec() and use fcntl with the necessary ifdefery 2017-03-27 12:52:56 +02:00
Alexandre Ratchov a48a424901 add portability bits for OS X 2017-03-27 12:34:26 +02:00
Alexandre Ratchov b5a1760af3 unexpand tabs 2016-01-09 09:23:56 +01:00
Alexandre Ratchov 7530bbf6d2 Pass full device name to audio/midi backends. 2015-12-09 11:13:11 +01:00
Alexandre Ratchov bbfde03621 please gcc 2015-10-20 09:15:09 +02:00
Alexandre Ratchov 5d431d3616 Replace hard-coded strings with macros, replace PATH_MAX with actual
string length, validate audio and midi device numbers
2015-10-02 14:28:17 +02:00
Alexandre Ratchov 6ddedf6c9f remove unused AUCAT_COOKIE environment variable 2015-10-01 08:50:13 +02:00
Alexandre Ratchov 33ad1a504d fix missing brace mistake, from jsg@ 2015-05-05 14:45:55 +02:00
Alexandre Ratchov 52e645e422 handle EINTR when reading /dev/urandom 2015-02-16 18:56:30 +01:00
Alexandre Ratchov 98027ba688 use SOCK_CLOEXEC 2015-02-16 11:52:36 +01:00
Alexandre Ratchov b989e17c05 don't use openbsd-specific SOCK_CLOEXEC 2015-01-18 00:16:36 +01:00
Alexandre Ratchov debf3b302c stop using param.h, from deraadt@ 2015-01-18 00:09:04 +01:00
Alexandre Ratchov b22be8340a log only errors if SNDIO_DEBUG=1 2013-12-10 20:14:48 +01:00
Alexandre Ratchov f4e64d573c spacing 2013-11-14 19:34:11 +01:00
Alexandre Ratchov abfcc198af sync to openbsd 2013-11-14 14:07:20 +01:00
Alexandre Ratchov 686dd7065e cleanup namespace 2013-11-12 09:49:28 +01:00
Alexandre Ratchov ca804a9ffe log successful connections if debug enabled 2013-03-04 08:59:49 +01:00
Alexandre Ratchov d6cb8d427d add bits for midi/N style port names 2012-11-06 20:52:40 +01:00
Alexandre Ratchov 26bf90b89d use gnu autoconf style HAVE_XXX macros 2012-10-29 18:08:36 +01:00
Alexandre Ratchov ea0d66a62d add explicit flow control in the protocol and use it for both midi and audio 2012-10-24 12:45:13 +02:00
Alexandre Ratchov 1247c187a7 s/unsigned/unsigned int/g, requested by deraadt 2012-04-11 09:21:29 +02:00
Alexandre Ratchov c8f20fb97f make devnum mandatory 2011-11-08 09:32:00 +01:00
Alexandre Ratchov 1d71c4a2fa stop using and duplicating ISSEP() macro 2011-11-01 17:30:39 +01:00
Alexandre Ratchov 33d6a705fd factor device name parsing code 2011-11-01 16:56:37 +01:00
Alexandre Ratchov e4ef0dc8d9 switch to type@hostname,unit/num.opt device names 2011-11-01 13:02:13 +01:00
Alexandre Ratchov dc2884ed7d Don't attempt to send data not available for sending yet. Analysed
and fixed by Remco <remco at d-compu.dyndns.org>, thanks!
2011-10-22 16:29:20 +02:00
Alexandre Ratchov 8c514d82b6 remove midicat 2011-10-18 00:29:58 +02:00
Alexandre Ratchov 979c909719 handle EINTR returned by connect() 2011-10-05 13:12:21 +02:00
Alexandre Ratchov 2f94e45ccd add random_bytes() function, used when arc4random() is not available 2011-05-23 13:40:50 +02:00
Alexandre Ratchov 8e25c4c95f include "bsd-compat.h" unconditionally 2011-05-06 14:11:18 +02:00
Alexandre Ratchov 681cac6593 don't read past the cookie end 2011-05-06 12:12:25 +02:00
Alexandre Ratchov 7c836dac01 move default device handling in backend code 2011-05-03 22:07:30 +02:00
Alexandre Ratchov 134bc5d779 convert messages headers to network byte order to allow
client and server with different byte orders to work
2011-05-01 15:29:56 +02:00
Alexandre Ratchov 32a1e3d36e use TCP_NODELAY 2011-04-28 08:10:14 +02:00
Alexandre Ratchov a583ebc5d9 simplify conditionals in aucat_mkcookie() 2011-04-28 01:31:15 +02:00
Alexandre Ratchov d12861225f use mkstemp() and arc4random() to generate cookie 2011-04-28 00:15:11 +02:00
Alexandre Ratchov 2e3fe03333 test cookie perms 2011-04-27 09:45:58 +02:00
Alexandre Ratchov 369b2b9faf unbreak midi 2011-04-19 01:52:03 +02:00
Alexandre Ratchov 9c6c106593 dont include file.h twice 2011-04-18 15:38:48 +02:00
Alexandre Ratchov 3f1215502b add TCP transport 2011-04-18 12:14:27 +02:00
Alexandre Ratchov 0663ca6f54 use a cookie for authentication 2011-04-16 18:30:24 +02:00
Alexandre Ratchov 313ba302a8 use common DPRINTF's for audio and midi code 2011-04-16 11:12:41 +02:00
Alexandre Ratchov 77a2cf5acb use AMSG_DATA's for midi 2011-04-15 18:02:18 +02:00