From: Todd C. Miller Date: Thu, 22 Feb 2018 21:27:37 +0000 (-0700) Subject: In device_handle_read() we need to reset the read event on error or X-Git-Tag: release-1.1pre16~19 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=03a94cb3148544230bdd306e905d2ce88c551c12;p=tinc 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. --- 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; }