(io_output_all,update_main,update_wait): Do not block on writing when

aborting commands for an update.  Move update_pending to the start of
the update sequence where the commands are aborted.
This commit is contained in:
Ron Koenderink 2005-08-21 17:17:38 +00:00
parent ef0dbf6790
commit a7fa7dee30
3 changed files with 14 additions and 3 deletions

View file

@ -62,6 +62,7 @@
#include "ioqueue.h"
#include "empio.h"
#include "gen.h" /* getfdtablesize */
#include "server.h"
#include "empthread.h"
@ -337,7 +338,11 @@ io_output_all(struct iop *iop)
{
int n;
while ((n = io_output(iop, IO_NOWAIT)) > 0) {
/*
* Mustn't block a player thread while update is pending, or else
* a malicous player could delay the update indefinitely
*/
while (((n = io_output(iop, IO_NOWAIT)) > 0) && !update_pending) {
empth_select(iop->fd, EMPTH_FD_WRITE);
}
return n;