diff --git a/sndiod/midi.c b/sndiod/midi.c index 4a20ba2..a52a77b 100644 --- a/sndiod/midi.c +++ b/sndiod/midi.c @@ -492,7 +492,8 @@ port_unref(struct port *c) #endif for (rxmask = 0, i = 0; i < MIDI_NEP; i++) rxmask |= midi_ep[i].txmask; - if ((rxmask & ~c->midi->self) == 0 && c->state == PORT_INIT && !c->hold) + if ((rxmask & c->midi->self) == 0 && c->midi->txmask == 0 && + c->state == PORT_INIT && !c->hold) port_drain(c); }