summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2009-08-28 06:37:06 +0000
committerratchov <ratchov@openbsd.org>2009-08-28 06:37:06 +0000
commit2eb6711f96a714d8bdb5fdb37512584acb59c8d7 (patch)
treec4ee78c6347dd55692d687acb4b04f444d466876 /lib
parenttop device before closing it. It's necessary to ensure that if we (diff)
downloadwireguard-openbsd-2eb6711f96a714d8bdb5fdb37512584acb59c8d7.tar.xz
wireguard-openbsd-2eb6711f96a714d8bdb5fdb37512584acb59c8d7.zip
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')
-rw-r--r--lib/libsndio/aucat.c8
-rw-r--r--lib/libsndio/sndio.c6
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);
}