Move code to disconnect all MIDI clients to its own routine.

This commit is contained in:
Alexandre Ratchov 2019-08-27 15:06:18 +02:00
parent db1e20ae8f
commit 6ee8e730f4
1 changed files with 15 additions and 8 deletions

View File

@ -530,11 +530,23 @@ port_open(struct port *c)
return 1;
}
int
port_close(struct port *c)
void
port_exitall(struct port *c)
{
int i;
struct midi *ep;
for (i = 0; i < MIDI_NEP; i++) {
ep = midi_ep + i;
if ((ep->txmask & c->midi->self) ||
(c->midi->txmask & ep->self))
ep->ops->exit(ep->arg);
}
}
int
port_close(struct port *c)
{
#ifdef DEBUG
if (c->state == PORT_CFG) {
port_log(c);
@ -545,12 +557,7 @@ port_close(struct port *c)
c->state = PORT_CFG;
port_mio_close(c);
for (i = 0; i < MIDI_NEP; i++) {
ep = midi_ep + i;
if ((ep->txmask & c->midi->self) ||
(c->midi->txmask & ep->self))
ep->ops->exit(ep->arg);
}
port_exitall(c);
return 1;
}