From: Martin Mares Date: Thu, 9 Jun 2011 14:51:15 +0000 (+0200) Subject: Main record-based I/O: allow freeing of recio from read handlers X-Git-Tag: v5.0~118^2~5 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1ceb8aa9bc2ddf1d02598a837866e8597f743386;p=libucw.git Main record-based I/O: allow freeing of recio from read handlers --- diff --git a/ucw/main-rec.c b/ucw/main-rec.c index 3c4c0678..2def9c89 100644 --- a/ucw/main-rec.c +++ b/ucw/main-rec.c @@ -131,6 +131,8 @@ restart: ; while (rio->read_running && (got = rio->read_handler(rio))) { DBG("RIO READ: Ate %u bytes", got); + if (got == ~0U) + return HOOK_IDLE; rio->read_rec_start += got; rio->read_avail -= got; rio->read_prev_avail = 0; @@ -326,6 +328,12 @@ static uns rhand(struct main_rec_io *rio) { rio->read_rec_start[r-1] = 0; printf("Read <%s>\n", rio->read_rec_start); + if (rio->read_rec_start[0] == '!') + { + rec_io_del(rio); + main_shut_down(); + return ~0U; + } rec_io_set_timeout(rio, 10000); rio->read_rec_start[r-1] = '\n'; rec_io_write(rio, rio->read_rec_start, r);