From b9b63c93e2e7a08427280392434f8d6af74d4158 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Fri, 28 Aug 2009 06:37:07 +0000 Subject: 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. --- lib/libsndio/aucat.c | 8 +++++++- lib/libsndio/sndio.c | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') 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 * @@ -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 * @@ -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); } -- cgit v1.2.3