summaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2014-04-20 18:26:24 +0200
committerMarc Hoersken <info@marc-hoersken.de>2014-04-20 18:26:24 +0200
commitfe1c0176c13af6b61ee59a2bc471af5c98e4993b (patch)
tree49d545904ec5ee7c8c5e30bc794f99fdd8966dcc /tests/server
parenteb01947e1d9fa1aea35ab3383f1213502606431e (diff)
downloadcurl-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.c17
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;
}