From 03a94cb3148544230bdd306e905d2ce88c551c12 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 22 Feb 2018 14:27:37 -0700 Subject: [PATCH] In device_handle_read() we need to reset the read event on error or it will keep firing. This is easy to reproduce by suspending the machine while tinc is running. --- src/mingw/device.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mingw/device.c b/src/mingw/device.c index 2cce1f2b..54e09942 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -76,6 +76,12 @@ static void device_handle_read(void *data, int flags) { if(!GetOverlappedResult(device_handle, &device_read_overlapped, &len, FALSE)) { logger(DEBUG_ALWAYS, LOG_ERR, "Error getting read result from %s %s: %s", device_info, device, strerror(errno)); + + if(GetLastError() != ERROR_IO_INCOMPLETE) { + /* Must reset event or it will keep firing. */ + ResetEvent(device_read_overlapped.hEvent); + } + return; } -- 2.20.1