-/* $OpenBSD: dev.c,v 1.81 2021/01/28 11:10:00 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.82 2021/01/28 11:15:31 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
case SLOT_START:
case SLOT_READY:
case SLOT_RUN:
- slot_stop(s);
- /* PASSTHROUGH */
case SLOT_STOP:
+ slot_stop(s, 0);
break;
}
dev_unref(s->dev);
* stop & detach if no data to drain.
*/
void
-slot_stop(struct slot *s)
+slot_stop(struct slot *s, int drain)
{
#ifdef DEBUG
if (log_level >= 3) {
}
if (s->pstate == SLOT_RUN) {
- if (s->mode & MODE_PLAY) {
+ if ((s->mode & MODE_PLAY) && drain) {
/*
* Don't detach, dev_cycle() will do it for us
* when the buffer is drained.
return;
}
slot_detach(s);
+ } else if (s->pstate == SLOT_STOP) {
+ slot_detach(s);
} else {
#ifdef DEBUG
if (log_level >= 3) {
-/* $OpenBSD: dev.h,v 1.30 2021/01/28 11:02:28 ratchov Exp $ */
+/* $OpenBSD: dev.h,v 1.31 2021/01/28 11:15:31 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
void slot_del(struct slot *);
void slot_setvol(struct slot *, unsigned int);
void slot_start(struct slot *);
-void slot_stop(struct slot *);
+void slot_stop(struct slot *, int);
void slot_read(struct slot *);
void slot_write(struct slot *);
void slot_initconv(struct slot *);
-/* $OpenBSD: sock.c,v 1.35 2020/04/26 14:13:22 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.36 2021/01/28 11:15:31 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
f->ralign = s->round * s->mix.bpf;
}
}
- slot_stop(s);
+ slot_stop(s, 1);
break;
case AMSG_SETPAR:
#ifdef DEBUG