diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-08-28 06:37:07 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-08-28 06:37:07 +0000 |
commit | b9b63c93e2e7a08427280392434f8d6af74d4158 (patch) | |
tree | b5bf49fe8fa35aad5b50af8ef9980da8d372c2bd /lib/libsndio | |
parent | 33a599c08e1d6be6abccee59b873302795b62621 (diff) |
add a new AMSG_BYE, sent by the client to requst the server to
free resources and drop the connection. This allows the client
to ensuire that at any time it's using only one connection, thus
only one MIDI control channel.
Diffstat (limited to 'lib/libsndio')
-rw-r--r-- | lib/libsndio/aucat.c | 8 | ||||
-rw-r--r-- | lib/libsndio/sndio.c | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index e7be5694107..4a9919825a2 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.25 2009/08/26 05:33:01 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.26 2009/08/28 06:37:06 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -271,6 +271,12 @@ aucat_close(struct sio_hdl *sh) { struct aucat_hdl *hdl = (struct aucat_hdl *)sh; + if (!hdl->sio.eof) { + AMSG_INIT(&hdl->wmsg); + hdl->wmsg.cmd = AMSG_BYE; + hdl->wtodo = sizeof(struct amsg); + (void)aucat_wmsg(hdl); + } while (close(hdl->fd) < 0 && errno == EINTR) ; /* nothing */ free(hdl); diff --git a/lib/libsndio/sndio.c b/lib/libsndio/sndio.c index 96b21732acf..23127bb722e 100644 --- a/lib/libsndio/sndio.c +++ b/lib/libsndio/sndio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sndio.c,v 1.21 2009/07/27 06:30:34 ratchov Exp $ */ +/* $OpenBSD: sndio.c,v 1.22 2009/08/28 06:37:06 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -237,6 +237,10 @@ sio_create(struct sio_hdl *hdl, struct sio_ops *ops, unsigned mode, int nbio) void sio_close(struct sio_hdl *hdl) { + if (!hdl->eof && hdl->started) { + DPRINTF("sio_close: not stopped\n"); + hdl->eof = 1; + } hdl->ops->close(hdl); } |