Fix ANCM websocket disconnect issue
This commit is contained in:
commit
f7633d8be9
|
|
@ -266,6 +266,7 @@ Routine Description:
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
//DWORD dwBuffSize = RECEIVE_BUFFER_SIZE;
|
//DWORD dwBuffSize = RECEIVE_BUFFER_SIZE;
|
||||||
|
|
||||||
|
*fHandleCreated = FALSE;
|
||||||
_pHandler = pHandler;
|
_pHandler = pHandler;
|
||||||
|
|
||||||
EnterCriticalSection(&_RequestLock);
|
EnterCriticalSection(&_RequestLock);
|
||||||
|
|
@ -1145,21 +1146,34 @@ Arguments:
|
||||||
_fCleanupInProgress = TRUE;
|
_fCleanupInProgress = TRUE;
|
||||||
|
|
||||||
_fIndicateCompletionToIis = TRUE;
|
_fIndicateCompletionToIis = TRUE;
|
||||||
//
|
|
||||||
// We need cancel IO for fast error handling
|
if (reason == ClientDisconnect || reason == ServerStateUnavailable)
|
||||||
// Reivist the code once CanelOutstandingIO api is available
|
|
||||||
//
|
|
||||||
/*if (_pWebSocketContext != NULL)
|
|
||||||
{
|
{
|
||||||
_pWebSocketContext->CancelOutstandingIO();
|
//
|
||||||
}*/
|
// Calling shutdown to notify the backend about disonnect
|
||||||
_pHttpContext->CancelIo();
|
//
|
||||||
|
WINHTTP_HELPER::sm_pfnWinHttpWebSocketShutdown(
|
||||||
|
_hWebSocketRequest,
|
||||||
|
WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS, // indicate that a server is terminating the connection because it encountered
|
||||||
|
// an unexpected condition that prevent it from fulfilling the request
|
||||||
|
NULL, // Reason
|
||||||
|
0); // length og Reason
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reason == ServerDisconnect || reason == ServerStateUnavailable)
|
||||||
|
{
|
||||||
|
_pHttpContext->CancelIo();
|
||||||
|
//
|
||||||
|
// CancelIo sometime may not be able to cannel pending websocket IO
|
||||||
|
// ResetConnection to force IISWebsocket module to release the pipeline
|
||||||
|
//
|
||||||
|
_pHttpContext->GetResponse()->ResetConnection();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Don't close the handle here,
|
// Don't close the handle here,
|
||||||
// as it trigger a WinHttp callback and let IIS pipeline continue
|
// as it trigger a WinHttp callback and let IIS pipeline continue
|
||||||
// Handle should be closed only in IndicateCompletionToIIS
|
// Handle should be closed only in IndicateCompletionToIIS
|
||||||
IndicateCompletionToIIS();
|
|
||||||
Finished:
|
Finished:
|
||||||
if (fLocked)
|
if (fLocked)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue