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;
|
||||
PCWSTR pszVersion = NULL;
|
||||
PCSTR pszVerb;
|
||||
DWORD dwTimeout = INFINITE;
|
||||
STACK_STRU(strVerb, 32);
|
||||
|
||||
//
|
||||
|
|
@ -1138,11 +1139,16 @@ FORWARDING_HANDLER::CreateWinHttpRequest(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
if (!pServerProcess->IsDebuggerAttached())
|
||||
{
|
||||
dwTimeout = pProtocol->QueryTimeout();
|
||||
}
|
||||
|
||||
if (!WinHttpSetTimeouts(m_hRequest,
|
||||
pProtocol->QueryTimeout(),
|
||||
pProtocol->QueryTimeout(),
|
||||
pProtocol->QueryTimeout(),
|
||||
pProtocol->QueryTimeout()))
|
||||
dwTimeout, //resolve timeout
|
||||
dwTimeout, // connect timeout
|
||||
dwTimeout, // send timeout
|
||||
dwTimeout)) // receive timeout
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
goto Finished;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ SERVER_PROCESS::Initialize(
|
|||
m_fAnonymousAuthEnabled = fAnonymousAuthEnabled;
|
||||
m_fWebsocketsEnabled = fWebsocketsEnabled;
|
||||
m_pProcessManager->ReferenceProcessManager();
|
||||
m_fDebuggerAttached = FALSE;
|
||||
|
||||
if (FAILED(hr = m_ProcessPath.Copy(*pszProcessExePath)) ||
|
||||
FAILED(hr = m_struLogFile.Copy(*pstruStdoutLogFile))||
|
||||
|
|
@ -719,6 +720,8 @@ SERVER_PROCESS::PostStartCheck(
|
|||
m_fReady = TRUE;
|
||||
|
||||
Finished:
|
||||
m_fDebuggerAttached = fDebuggerAttached;
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (m_pForwarderConnection != NULL)
|
||||
|
|
@ -1277,7 +1280,12 @@ SERVER_PROCESS::SendSignal(
|
|||
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);
|
||||
goto Finished;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,14 @@ public:
|
|||
return m_fReady;
|
||||
}
|
||||
|
||||
BOOL
|
||||
IsDebuggerAttached(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_fDebuggerAttached;
|
||||
}
|
||||
|
||||
VOID
|
||||
StopProcess(
|
||||
VOID
|
||||
|
|
@ -230,6 +238,7 @@ private:
|
|||
BOOL m_fBasicAuthEnabled;
|
||||
BOOL m_fAnonymousAuthEnabled;
|
||||
BOOL m_fWebsocketsEnabled;
|
||||
BOOL m_fDebuggerAttached;
|
||||
|
||||
STTIMER m_Timer;
|
||||
SOCKET m_socket;
|
||||
|
|
|
|||
Loading…
Reference in New Issue