ttyObject: still problems recovering from desynced connection.

tcflush doesn't seem to completely flush the os buffers...
This commit is contained in:
Martin Preuss
2026-05-06 00:25:23 +02:00
parent 636d6ce643
commit bcbd777b8f

View File

@@ -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;
}