From 956e7d9f8bc664442b8785ec783b2c3f8d8f4122 Mon Sep 17 00:00:00 2001 From: David Lesaffre Date: Tue, 29 Jan 2013 16:07:16 +0100 Subject: [PATCH] making a working version for my CISCO 800 series router --- channels/serial/client/serial_main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/channels/serial/client/serial_main.c b/channels/serial/client/serial_main.c index 71eefe61d..f222c400a 100644 --- a/channels/serial/client/serial_main.c +++ b/channels/serial/client/serial_main.c @@ -340,13 +340,13 @@ static void* serial_thread_func(void* arg) while (1) { - freerdp_thread_wait(serial->thread); + freerdp_thread_wait_timeout(serial->thread, 500); serial->nfds = 1; FD_ZERO(&serial->read_fds); FD_ZERO(&serial->write_fds); - serial->tv.tv_sec = 20; + serial->tv.tv_sec = 1; serial->tv.tv_usec = 0; serial->select_timeout = 0; @@ -356,10 +356,13 @@ static void* serial_thread_func(void* arg) freerdp_thread_reset(serial->thread); serial_process_irp_list(serial); - if (WaitForSingleObject(serial->in_event, 0) == WAIT_OBJECT_0) - { - if (serial_check_fds(serial)) - ResetEvent(serial->in_event); + switch (WaitForSingleObject(serial->in_event, 0)) { + case WAIT_OBJECT_0: + case WAIT_TIMEOUT: + { + if (serial_check_fds(serial)) + ResetEvent(serial->in_event); + } } } @@ -683,6 +686,7 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial) case 0: if (serial->select_timeout) { + __serial_check_fds(serial); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE, STATUS_TIMEOUT); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ, STATUS_TIMEOUT); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE, STATUS_TIMEOUT);