From 1ceb8aa9bc2ddf1d02598a837866e8597f743386 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 9 Jun 2011 16:51:15 +0200 Subject: [PATCH] Main record-based I/O: allow freeing of recio from read handlers --- ucw/main-rec.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.39.2