summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-08-28 06:37:07 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-08-28 06:37:07 +0000
commitb9b63c93e2e7a08427280392434f8d6af74d4158 (patch)
treeb5bf49fe8fa35aad5b50af8ef9980da8d372c2bd /usr.bin/aucat
parent33a599c08e1d6be6abccee59b873302795b62621 (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 'usr.bin/aucat')
-rw-r--r--usr.bin/aucat/amsg.h3
-rw-r--r--usr.bin/aucat/sock.c8
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/aucat/amsg.h b/usr.bin/aucat/amsg.h
index f0563e9019a..7536f99c7b9 100644
--- a/usr.bin/aucat/amsg.h
+++ b/usr.bin/aucat/amsg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amsg.h,v 1.9 2009/07/25 10:52:18 ratchov Exp $ */
+/* $OpenBSD: amsg.h,v 1.10 2009/08/28 06:37:06 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -39,6 +39,7 @@ struct amsg {
#define AMSG_GETCAP 7 /* get capabilities */
#define AMSG_SETVOL 8 /* set volume */
#define AMSG_HELLO 9 /* say hello, check versions and so ... */
+#define AMSG_BYE 10 /* ask server to drop connection */
uint32_t cmd;
uint32_t __pad;
union {
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index 2c0e0705366..d79ec01f04d 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.27 2009/08/27 06:54:23 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.28 2009/08/28 06:37:06 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -947,6 +947,12 @@ sock_execmsg(struct sock *f)
f->rstate = SOCK_RRET;
f->rtodo = sizeof(struct amsg);
break;
+ case AMSG_BYE:
+ DPRINTFN(2, "sock_execmsg: %p: BYE\n", f);
+ if (f->pstate != SOCK_INIT)
+ DPRINTF("sock_execmsg: %p: BYE, bad state\n", f);
+ aproc_del(f->pipe.file.rproc);
+ return 0;
default:
DPRINTF("sock_execmsg: %p bogus command\n", f);
aproc_del(f->pipe.file.rproc);