=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/sock.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- src/usr.bin/sndiod/sock.c 2012/11/23 07:03:28 1.1 +++ src/usr.bin/sndiod/sock.c 2012/11/30 20:30:24 1.2 @@ -1,4 +1,4 @@ -/* $OpenBSD: sock.c,v 1.1 2012/11/23 07:03:28 ratchov Exp $ */ +/* $OpenBSD: sock.c,v 1.2 2012/11/30 20:30:24 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * @@ -505,7 +505,7 @@ int sock_rdata(struct sock *f) { - struct abuf *buf; + unsigned char midibuf[MIDI_BUFSZ]; unsigned char *data; int n, count; @@ -516,19 +516,23 @@ panic(); } #endif - if (f->slot) - buf = &f->slot->mix.buf; - else - buf = &f->midi->ibuf; while (f->rtodo > 0) { - data = abuf_wgetblk(buf, &count); + if (f->slot) + data = abuf_wgetblk(&f->slot->mix.buf, &count); + else { + data = midibuf; + count = MIDI_BUFSZ; + } if (count > f->rtodo) count = f->rtodo; n = sock_fdread(f, data, count); if (n == 0) return 0; f->rtodo -= n; - abuf_wcommit(buf, n); + if (f->slot) + abuf_wcommit(&f->slot->mix.buf, n); + else + midi_in(f->midi, midibuf, n); } #ifdef DEBUG if (log_level >= 4) { @@ -538,8 +542,6 @@ #endif if (f->slot) slot_write(f->slot); - if (f->midi) - f->fillpending += midi_in(f->midi); return 1; } @@ -864,14 +866,9 @@ c = port_bynum(p->devnum - 32); if (c == NULL) return 0; - if (mode & MODE_MIDIOUT) - f->midi->txmask |= c->midi->rxmask; - if (mode & MODE_MIDIIN) - c->midi->txmask |= f->midi->rxmask; + midi_link(f->midi, c->midi); } else return 0; - if (mode & MODE_MIDIOUT) - f->fillpending = MIDI_BUFSZ; return 1; } f->opt = opt_byname(p->opt, p->devnum);