Dont attempt to drain disconnected clients

This commit is contained in:
Alexandre Ratchov 2021-01-22 16:59:30 +01:00
parent 6f741dab61
commit ea692625ea
3 changed files with 7 additions and 6 deletions

View File

@ -1973,9 +1973,8 @@ slot_del(struct slot *s)
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);
@ -2196,7 +2195,7 @@ slot_detach(struct slot *s)
* 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) {
@ -2215,7 +2214,7 @@ slot_stop(struct slot *s)
}
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.
@ -2224,6 +2223,8 @@ slot_stop(struct slot *s)
return;
}
slot_detach(s);
} else if (s->pstate == SLOT_STOP) {
slot_detach(s);
} else {
#ifdef DEBUG
if (log_level >= 3) {

View File

@ -306,7 +306,7 @@ struct slot *slot_new(struct dev *, struct opt *, unsigned int, char *,
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 *);

View File

@ -1130,7 +1130,7 @@ sock_execmsg(struct sock *f)
f->ralign = s->round * s->mix.bpf;
}
}
slot_stop(s);
slot_stop(s, 1);
break;
case AMSG_SETPAR:
#ifdef DEBUG