reset some timeout values to infinite if debugger is attached (#776)
This commit is contained in:
parent
a84fcabb25
commit
341f6c4f30
|
|
@ -1098,6 +1098,7 @@ FORWARDING_HANDLER::CreateWinHttpRequest(
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
PCWSTR pszVersion = NULL;
|
PCWSTR pszVersion = NULL;
|
||||||
PCSTR pszVerb;
|
PCSTR pszVerb;
|
||||||
|
DWORD dwTimeout = INFINITE;
|
||||||
STACK_STRU(strVerb, 32);
|
STACK_STRU(strVerb, 32);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1138,11 +1139,16 @@ FORWARDING_HANDLER::CreateWinHttpRequest(
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pServerProcess->IsDebuggerAttached())
|
||||||
|
{
|
||||||
|
dwTimeout = pProtocol->QueryTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
if (!WinHttpSetTimeouts(m_hRequest,
|
if (!WinHttpSetTimeouts(m_hRequest,
|
||||||
pProtocol->QueryTimeout(),
|
dwTimeout, //resolve timeout
|
||||||
pProtocol->QueryTimeout(),
|
dwTimeout, // connect timeout
|
||||||
pProtocol->QueryTimeout(),
|
dwTimeout, // send timeout
|
||||||
pProtocol->QueryTimeout()))
|
dwTimeout)) // receive timeout
|
||||||
{
|
{
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ SERVER_PROCESS::Initialize(
|
||||||
m_fAnonymousAuthEnabled = fAnonymousAuthEnabled;
|
m_fAnonymousAuthEnabled = fAnonymousAuthEnabled;
|
||||||
m_fWebsocketsEnabled = fWebsocketsEnabled;
|
m_fWebsocketsEnabled = fWebsocketsEnabled;
|
||||||
m_pProcessManager->ReferenceProcessManager();
|
m_pProcessManager->ReferenceProcessManager();
|
||||||
|
m_fDebuggerAttached = FALSE;
|
||||||
|
|
||||||
if (FAILED(hr = m_ProcessPath.Copy(*pszProcessExePath)) ||
|
if (FAILED(hr = m_ProcessPath.Copy(*pszProcessExePath)) ||
|
||||||
FAILED(hr = m_struLogFile.Copy(*pstruStdoutLogFile))||
|
FAILED(hr = m_struLogFile.Copy(*pstruStdoutLogFile))||
|
||||||
|
|
@ -719,6 +720,8 @@ SERVER_PROCESS::PostStartCheck(
|
||||||
m_fReady = TRUE;
|
m_fReady = TRUE;
|
||||||
|
|
||||||
Finished:
|
Finished:
|
||||||
|
m_fDebuggerAttached = fDebuggerAttached;
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
if (m_pForwarderConnection != NULL)
|
if (m_pForwarderConnection != NULL)
|
||||||
|
|
@ -1277,7 +1280,12 @@ SERVER_PROCESS::SendSignal(
|
||||||
goto Finished;
|
goto Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForSingleObject(m_hShutdownHandle, m_dwShutdownTimeLimitInMS) != WAIT_OBJECT_0)
|
//
|
||||||
|
// Reset the shutdown timeout if debugger is attached.
|
||||||
|
// Do it only for the case that debugger is attached during process creation
|
||||||
|
// as IsDebuggerIsAttached call is too heavy
|
||||||
|
//
|
||||||
|
if (WaitForSingleObject(m_hShutdownHandle, m_fDebuggerAttached ? INFINITE : m_dwShutdownTimeLimitInMS) != WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
hr = HRESULT_FROM_WIN32(ERROR_TIMEOUT);
|
hr = HRESULT_FROM_WIN32(ERROR_TIMEOUT);
|
||||||
goto Finished;
|
goto Finished;
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,14 @@ public:
|
||||||
return m_fReady;
|
return m_fReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
IsDebuggerAttached(
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return m_fDebuggerAttached;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
StopProcess(
|
StopProcess(
|
||||||
VOID
|
VOID
|
||||||
|
|
@ -230,6 +238,7 @@ private:
|
||||||
BOOL m_fBasicAuthEnabled;
|
BOOL m_fBasicAuthEnabled;
|
||||||
BOOL m_fAnonymousAuthEnabled;
|
BOOL m_fAnonymousAuthEnabled;
|
||||||
BOOL m_fWebsocketsEnabled;
|
BOOL m_fWebsocketsEnabled;
|
||||||
|
BOOL m_fDebuggerAttached;
|
||||||
|
|
||||||
STTIMER m_Timer;
|
STTIMER m_Timer;
|
||||||
SOCKET m_socket;
|
SOCKET m_socket;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue