From c70f456e5c3549e177d6788aa19249beb5d08515 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Wed, 30 Mar 2011 18:28:32 +0200 Subject: [PATCH] call sock_write() at the end of sock_read() in order to send ACKs, initial positions, volumes and alikes. It's not OK to call it in sock_execmsg() because it can generate messages that would be sent before the message to return --- aucat/sock.c | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/aucat/sock.c b/aucat/sock.c index 92487a1..0e094ce 100644 --- a/aucat/sock.c +++ b/aucat/sock.c @@ -598,14 +598,6 @@ sock_attach(struct sock *f, int force) f->xrun, f->opt->maxweight); if (f->mode & MODE_PLAY) dev_setvol(f->dev, rbuf, MIDI_TO_ADATA(f->vol)); - - /* - * Send the initial position, if needed. - */ - for (;;) { - if (!sock_write(f)) - break; - } } void @@ -1421,24 +1413,6 @@ sock_execmsg(struct sock *f) aproc_del(f->pipe.file.rproc); return 0; } - if (f->rstate == SOCK_RRET) { - if (f->wstate != SOCK_WIDLE || - !sock_wmsg(f, &f->rmsg, &f->rtodo)) - return 0; -#ifdef DEBUG - if (debug_level >= 3) { - sock_dbg(f); - dbg_puts(": RRET done\n"); - } -#endif - if (f->pstate == SOCK_MIDI && (f->mode & MODE_MIDIOUT)) { - f->rstate = SOCK_RDATA; - f->rtodo = 0; - } else { - f->rstate = SOCK_RMSG; - f->rtodo = sizeof(struct amsg); - } - } return 1; } @@ -1625,6 +1599,13 @@ sock_read(struct sock *f) #endif return 0; } + for (;;) { + /* + * send pending ACKs, initial positions, initial volumes + */ + if (!sock_write(f)) + break; + } return 1; }