X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fmingw%2Fdevice.c;h=b7a191f4ebb490a3c68e074ab5e6964c4188a407;hb=3a149f7521dfff67e6a790c1a830afc649ae083e;hp=eb3663d7921a322b2c15e4f19b34bc7b49d7c9f2;hpb=8145a3392bdcff4d7856ba72e66a90d73d887c00;p=tinc diff --git a/src/mingw/device.c b/src/mingw/device.c index eb3663d7..b7a191f4 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -1,7 +1,7 @@ /* device.c -- Interaction with Windows tap driver in a MinGW environment Copyright (C) 2002-2005 Ivo Timmermans, - 2002-2014 Guus Sliepen + 2002-2018 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -71,10 +71,20 @@ static void device_issue_read() { } static void device_handle_read(void *data, int flags) { + (void)data; + (void)flags; + DWORD len; + 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; } @@ -98,8 +108,8 @@ static bool setup_device(void) { int err; - get_config_string(lookup_config(config_tree, "Device"), &device); - get_config_string(lookup_config(config_tree, "Interface"), &iface); + get_config_string(lookup_config(&config_tree, "Device"), &device); + get_config_string(lookup_config(&config_tree, "Interface"), &iface); if(device && iface) { logger(DEBUG_ALWAYS, LOG_WARNING, "Warning: both Device and Interface specified, results may not be as expected"); @@ -205,7 +215,7 @@ static bool setup_device(void) { if(info[0] == 9 && info[1] >= 21) logger(DEBUG_ALWAYS, LOG_WARNING, "You are using the newer (>= 9.0.0.21, NDIS6) series of TAP-Win32 drivers. " - "Using these drivers with tinc is not recommanded as it can result in poor performance. " + "Using these drivers with tinc is not recommended as it can result in poor performance. " "You might want to revert back to 9.0.0.9 instead."); } } @@ -293,6 +303,7 @@ static void close_device(void) { } static bool read_packet(vpn_packet_t *packet) { + (void)packet; return false; }