Skip to content

Commit

Permalink
In device_handle_read() we need to reset the read event on error or
Browse files Browse the repository at this point in the history
it will keep firing.  This is easy to reproduce by suspending the
machine while tinc is running.
  • Loading branch information
millert committed Feb 22, 2018
1 parent f10e98f commit 03a94cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mingw/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 03a94cb

Please sign in to comment.