diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2014-04-20 18:26:24 +0200 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2014-04-20 18:26:24 +0200 |
commit | fe1c0176c13af6b61ee59a2bc471af5c98e4993b (patch) | |
tree | 49d545904ec5ee7c8c5e30bc794f99fdd8966dcc /tests/server | |
parent | eb01947e1d9fa1aea35ab3383f1213502606431e (diff) | |
download | curl-fe1c0176c13af6b61ee59a2bc471af5c98e4993b.tar.gz |
sockfilt.c: ignore non-key-events and continue waiting for input
Diffstat (limited to 'tests/server')
-rw-r--r-- | tests/server/sockfilt.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index a15baeb7f..7328ca495 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -515,15 +515,24 @@ static void lograw(unsigned char *buffer, ssize_t len) */ static DWORD WINAPI select_ws_stdin_wait_thread(LPVOID lpParameter) { + INPUT_RECORD inputrecord; HANDLE handle; - DWORD mode; + DWORD length; handle = (HANDLE) lpParameter; - if(GetConsoleMode(handle, &mode)) - WaitForSingleObjectEx(handle, INFINITE, FALSE); + if(GetConsoleMode(handle, &length)) { + while(WaitForSingleObjectEx(handle, INFINITE, FALSE) == WAIT_OBJECT_0) { + if(PeekConsoleInput(handle, &inputrecord, 1, &length)) { + if(length == 1 && inputrecord.EventType != KEY_EVENT) + ReadConsoleInput(handle, &inputrecord, 1, &length); + else + break; + } + } + } else - ReadFile(handle, NULL, 0, &mode, NULL); + ReadFile(handle, NULL, 0, &length, NULL); return 0; } |