From 2e31d0502fd10c46fea3eb5e8f52fa3bc8e53f04 Mon Sep 17 00:00:00 2001 From: corvid Date: Sat, 9 Apr 2016 15:53:21 +0000 Subject: if we get an error (e.g. ECONNRESET) while reading, abort the read and show a status message --- src/IO/IO.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/IO/IO.c') diff --git a/src/IO/IO.c b/src/IO/IO.c index 139cf667..4312fddb 100644 --- a/src/IO/IO.c +++ b/src/IO/IO.c @@ -285,6 +285,10 @@ static void IO_fd_read_cb(int fd, void *data) } else { if (IO_callback(io) == 0) a_IOwatch_remove_fd(fd, DIO_READ); + if ((io = IO_get(io_key)) && io->Status) { + /* check io because IO_read OpSend could trigger abort */ + a_IO_ccc(OpAbort, 2, FWD, io->Info, io, NULL); + } } } @@ -443,7 +447,8 @@ void a_IO_ccc(int Op, int Branch, int Dir, ChainLink *Info, dFree(dbuf); break; case OpEnd: - a_Chain_fcb(OpEnd, Info, NULL, NULL); + case OpAbort: + a_Chain_fcb(Op, Info, NULL, NULL); IO_close_fd(io, IO_StopRdWr); /* IO_StopRd would leak FDs */ IO_free(io); dFree(Info); -- cgit v1.2.3