Windows build warning removal, be more defensive in Windows tap driver code, and clean up service start/stop in installer.
This commit is contained in:
@@ -594,7 +594,10 @@ void WindowsEthernetTap::threadMain()
|
||||
|
||||
Utils::snprintf(tapPath,sizeof(tapPath),"\\\\.\\Global\\%s.tap",_netCfgInstanceId.c_str());
|
||||
int prevTapResetStatus = _systemTapResetStatus;
|
||||
bool throwOneAway = true; // "Power cycle" the network port once on startup, because Windows...
|
||||
while (_run) {
|
||||
Sleep(500);
|
||||
|
||||
_tap = CreateFileA(tapPath,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_SYSTEM|FILE_FLAG_OVERLAPPED,NULL);
|
||||
if (_tap == INVALID_HANDLE_VALUE) {
|
||||
fprintf(stderr,"Error opening %s -- retrying.\r\n",tapPath);
|
||||
@@ -698,7 +701,8 @@ void WindowsEthernetTap::threadMain()
|
||||
ReadFile(_tap,tapReadBuf,sizeof(tapReadBuf),NULL,&tapOvlRead);
|
||||
bool writeInProgress = false;
|
||||
while (_run) {
|
||||
if (prevTapResetStatus != _systemTapResetStatus) {
|
||||
if ((prevTapResetStatus != _systemTapResetStatus)||(throwOneAway)) {
|
||||
throwOneAway = false;
|
||||
prevTapResetStatus = _systemTapResetStatus;
|
||||
break; // this will cause us to close and reopen the tap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user