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
This commit is contained in:
Alexandre Ratchov 2011-03-30 18:28:32 +02:00
parent dadc1b872c
commit c70f456e5c
1 changed files with 7 additions and 26 deletions

View File

@ -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;
}