From bcbd777b8fb2011843ed30b2a58840291be00b72 Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Wed, 6 May 2026 00:25:23 +0200 Subject: [PATCH] ttyObject: still problems recovering from desynced connection. tcflush doesn't seem to completely flush the os buffers... --- aqhome/ipc2/tty_object.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aqhome/ipc2/tty_object.c b/aqhome/ipc2/tty_object.c index 49ccacd..03056b0 100644 --- a/aqhome/ipc2/tty_object.c +++ b/aqhome/ipc2/tty_object.c @@ -50,11 +50,20 @@ static int _fdSetBlocking(int sk, int fl); AQH_OBJECT *AQH_TtyObject_new(AQH_EVENT_LOOP *eventLoop, int fd, int fdMode) { AQH_OBJECT *o; + int rv; o=AQH_FdObject_new(eventLoop, fd, fdMode); AQH_FdObject_SetStartMsgFn(o, _cbStartMsg); AQH_FdObject_SetEndMsgFn(o, _cbEndMsg); AQH_FdObject_SetFlushFn(o, _cbFlush); + + rv=tcflush(fd, TCIOFLUSH); + if (rv<0) { + if (errno!=EINTR && errno!=EWOULDBLOCK && errno!=EAGAIN) { + DBG_ERROR(AQH_LOGDOMAIN, "Error on tcflush: %s (%d)", strerror(errno), errno); + } + } + return o; }