This commit is contained in:
Jason Sandlin 2020-03-20 15:08:07 -07:00 коммит произвёл GitHub
Родитель a3070c6e11
Коммит 98e0c141d6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 95 добавлений и 94 удалений

Просмотреть файл

@ -128,6 +128,7 @@ HC_DECLARE_TRACE_AREA(WEBSOCKET);
catch (...) { ::xbox::httpclient::detail::UnknownExceptionToResult(file, line); return errCode; }
#define RETURN_IF_PERFORM_CALLED(call) if (call->performCalled) return E_HC_PERFORM_ALREADY_CALLED;
#define TO_ULL(x) static_cast<unsigned long long>(x)
NAMESPACE_XBOX_HTTP_CLIENT_DETAIL_BEGIN

Просмотреть файл

@ -195,7 +195,7 @@ void winhttp_http_task::read_next_response_chunk(_In_ winhttp_http_task* pReques
if (!WinHttpQueryDataAvailable(pRequestContext->m_hRequest, nullptr))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryDataAvailable errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryDataAvailable errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
}
}
@ -221,7 +221,7 @@ void winhttp_http_task::_multiple_segment_write_data(_In_ winhttp_http_task* pRe
nullptr))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpWriteData errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpWriteData errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return;
}
@ -241,7 +241,7 @@ void winhttp_http_task::callback_status_write_complete(
_In_ void* statusInfo)
{
DWORD bytesWritten = *((DWORD *)statusInfo);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE bytesWritten=%d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), bytesWritten);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE bytesWritten=%d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), bytesWritten);
if (pRequestContext->m_requestBodyType == content_length_chunked)
{
@ -252,7 +252,7 @@ void winhttp_http_task::callback_status_write_complete(
if (!WinHttpReceiveResponse(hRequestHandle, nullptr))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpReceiveResponse errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpReceiveResponse errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return;
}
@ -269,7 +269,7 @@ void winhttp_http_task::callback_status_request_error(
return;
DWORD errorCode = error_result->dwError;
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_REQUEST_ERROR dwResult=%d dwError=%d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), error_result->dwResult, error_result->dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_REQUEST_ERROR dwResult=%d dwError=%d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), error_result->dwResult, error_result->dwError);
bool reissueSend{ false };
@ -367,7 +367,7 @@ void winhttp_http_task::callback_status_sendrequest_complete(
_In_ winhttp_http_task* pRequestContext,
_In_ void* /*statusInfo*/)
{
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId() );
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId() );
if (pRequestContext->m_requestBodyType == content_length_chunked)
{
@ -378,7 +378,7 @@ void winhttp_http_task::callback_status_sendrequest_complete(
if (!WinHttpReceiveResponse(hRequestHandle, nullptr))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpReceiveResponse errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpReceiveResponse errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return;
}
@ -404,7 +404,7 @@ HRESULT winhttp_http_task::query_header_length(
DWORD dwError = GetLastError();
if (dwError != ERROR_INSUFFICIENT_BUFFER)
{
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", HCHttpCallGetId(call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", TO_ULL(HCHttpCallGetId(call)), GetCurrentThreadId(), dwError);
return E_FAIL;
}
}
@ -438,7 +438,7 @@ uint32_t winhttp_http_task::parse_status_code(
WINHTTP_NO_HEADER_INDEX))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return 0;
}
@ -480,7 +480,7 @@ void winhttp_http_task::callback_status_headers_available(
_In_ winhttp_http_task* pRequestContext,
_In_ void* /*statusInfo*/)
{
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId() );
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId() );
// First need to query to see what the headers size is.
DWORD headerBufferLength = 0;
@ -504,7 +504,7 @@ void winhttp_http_task::callback_status_headers_available(
WINHTTP_NO_HEADER_INDEX))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpQueryHeaders errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return;
}
@ -522,7 +522,7 @@ void winhttp_http_task::callback_status_data_available(
// Status information contains pointer to DWORD containing number of bytes available.
DWORD newBytesAvailable = *(PDWORD)statusInfo;
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE newBytesAvailable=%d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), newBytesAvailable);
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE newBytesAvailable=%d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), newBytesAvailable);
if (newBytesAvailable > 0)
{
@ -538,7 +538,7 @@ void winhttp_http_task::callback_status_data_available(
nullptr))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpReadData errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), GetLastError());
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpReadData errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), GetLastError());
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
return;
}
@ -569,7 +569,7 @@ void winhttp_http_task::callback_status_read_complete(
// Status information length contains the number of bytes read.
const DWORD bytesRead = statusInfoLength;
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_READ_COMPLETE bytesRead=%d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), bytesRead);
HC_TRACE_INFORMATION(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WINHTTP_CALLBACK_STATUS_READ_COMPLETE bytesRead=%d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), bytesRead);
// If no bytes have been read, then this is the end of the response.
if (bytesRead == 0)
@ -748,7 +748,7 @@ void winhttp_http_task::set_autodiscover_proxy(
if (!result)
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
}
}
else
@ -791,7 +791,7 @@ HRESULT winhttp_http_task::connect(
{
if (!m_hSession)
{
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] no session", HCHttpCallGetId(m_call), GetCurrentThreadId());
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] no session", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId());
return E_INVALIDARG;
}
@ -813,7 +813,7 @@ HRESULT winhttp_http_task::connect(
timeoutInMilliseconds))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetTimeouts errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetTimeouts errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
}
@ -832,7 +832,7 @@ HRESULT winhttp_http_task::connect(
if (m_hConnection == nullptr)
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpConnect errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpConnect errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
@ -859,7 +859,7 @@ HRESULT winhttp_http_task::send(
if (m_hRequest == nullptr)
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpOpenRequest errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpOpenRequest errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
@ -907,7 +907,7 @@ HRESULT winhttp_http_task::send(
WINHTTP_ADDREQ_FLAG_ADD))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
}
@ -919,7 +919,7 @@ HRESULT winhttp_http_task::send(
0))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetStatusCallback errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetStatusCallback errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
@ -932,7 +932,7 @@ HRESULT winhttp_http_task::send(
0))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
}
@ -950,7 +950,7 @@ HRESULT winhttp_http_task::send(
WINHTTP_ADDREQ_FLAG_ADD))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
}
@ -963,7 +963,7 @@ HRESULT winhttp_http_task::send(
if (!status)
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpAddRequestHeaders errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
#pragma warning( pop )
@ -988,7 +988,7 @@ HRESULT winhttp_http_task::send(
(DWORD_PTR)this))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSendRequest errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] WinHttpSendRequest errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
return HRESULT_FROM_WIN32(dwError);
}
@ -1235,7 +1235,7 @@ HRESULT winhttp_http_task::send_websocket_message(
DWORD dwResult = WaitForSingleObject(m_hWebsocketWriteComplete, 30000);
if (dwResult == WAIT_TIMEOUT)
{
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] write complete timeout", HCHttpCallGetId(m_call), GetCurrentThreadId());
HC_TRACE_ERROR(HTTPCLIENT, "winhttp_http_task [ID %llu] [TID %ul] write complete timeout", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId());
return E_FAIL;
}
@ -1369,7 +1369,7 @@ void winhttp_http_task::callback_websocket_status_read_complete(
HRESULT winhttp_http_task::websocket_start_listening()
{
HC_TRACE_VERBOSE(HTTPCLIENT, "WINHTTP_WEB_SOCKET_UTF8 [ID %llu] [TID %ul] listening", HCHttpCallGetId(m_call), GetCurrentThreadId());
HC_TRACE_VERBOSE(HTTPCLIENT, "WINHTTP_WEB_SOCKET_UTF8 [ID %llu] [TID %ul] listening", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId());
HRESULT hr = m_websocketResponseBuffer.Resize(WINHTTP_WEBSOCKET_RECVBUFFER_SIZE);
if (SUCCEEDED(hr))
{
@ -1411,7 +1411,7 @@ HRESULT winhttp_http_task::websocket_read_message()
dwError = WinHttpWebSocketReceive(m_hRequest, bufferPtr, (DWORD)bufferSize, &bytesRead, &bufType);
if (dwError)
{
HC_TRACE_ERROR(HTTPCLIENT, "[WinHttp] websocket_read_message [ID %llu] [TID %ul] errorcode %d", HCHttpCallGetId(m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "[WinHttp] websocket_read_message [ID %llu] [TID %ul] errorcode %d", TO_ULL(HCHttpCallGetId(m_call)), GetCurrentThreadId(), dwError);
}
}
@ -1422,7 +1422,7 @@ void winhttp_http_task::callback_websocket_status_headers_available(
_In_ HINTERNET hRequestHandle,
_In_ winhttp_http_task* pRequestContext)
{
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] Websocket WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId());
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] Websocket WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId());
// Application should check what is the HTTP status code returned by the server and behave accordingly.
// WinHttpWebSocketCompleteUpgrade will fail if the HTTP status code is different than 101.
@ -1430,7 +1430,7 @@ void winhttp_http_task::callback_websocket_status_headers_available(
if (pRequestContext->m_hRequest == NULL)
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpWebSocketCompleteUpgrade errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpWebSocketCompleteUpgrade errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
}
@ -1438,7 +1438,7 @@ void winhttp_http_task::callback_websocket_status_headers_available(
if (!WinHttpSetOption(pRequestContext->m_hRequest, WINHTTP_OPTION_CONTEXT_VALUE, &pThis, sizeof(pThis)))
{
DWORD dwError = GetLastError();
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", HCHttpCallGetId(pRequestContext->m_call), GetCurrentThreadId(), dwError);
HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu] [TID %ul] WinHttpSetOption errorcode %d", TO_ULL(HCHttpCallGetId(pRequestContext->m_call)), GetCurrentThreadId(), dwError);
pRequestContext->complete_task(E_FAIL, HRESULT_FROM_WIN32(dwError));
}

Просмотреть файл

@ -49,7 +49,7 @@ try
call->retryIterationNumber = 0;
call->id = ++httpSingleton->m_lastId;
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallCreate [ID %llu]", call->id);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallCreate [ID %llu]", TO_ULL(call->id));
*callHandle = call;
return S_OK;
@ -66,7 +66,7 @@ try
return nullptr;
}
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallDuplicateHandle [ID %llu]", static_cast<HC_CALL*>(call)->id);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallDuplicateHandle [ID %llu]", TO_ULL(static_cast<HC_CALL*>(call)->id));
++call->refCount;
return call;
@ -84,7 +84,7 @@ try
return E_INVALIDARG;
}
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallCloseHandle [ID %llu]", call->id);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallCloseHandle [ID %llu]", TO_ULL(call->id));
int refCount = --call->refCount;
if (refCount <= 0)
{
@ -134,7 +134,7 @@ HRESULT perform_http_call(
}
catch (...)
{
if (call->traceCall) { HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu]: failed", static_cast<HC_CALL*>(call)->id); }
if (call->traceCall) { HC_TRACE_ERROR(HTTPCLIENT, "HCHttpCallPerform [ID %llu]: failed", TO_ULL(static_cast<HC_CALL*>(call)->id)); }
}
}
}
@ -224,7 +224,7 @@ bool http_call_should_retry(
HCHttpCallRequestGetTimeoutWindow(call, &timeoutWindowInSeconds);
std::chrono::seconds timeoutWindow = std::chrono::seconds(timeoutWindowInSeconds);
std::chrono::milliseconds remainingTimeBeforeTimeout = timeoutWindow - timeElapsedSinceFirstCall;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] remainingTimeBeforeTimeout %lld ms", call->id, remainingTimeBeforeTimeout.count()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] remainingTimeBeforeTimeout %lld ms", TO_ULL(call->id), remainingTimeBeforeTimeout.count()); }
// Based on the retry iteration, delay 2,4,8,16,etc seconds by default between retries
// Jitter the response between the current and next delay based on system clock
@ -250,7 +250,7 @@ bool http_call_should_retry(
{
call->delayBeforeRetry = waitTime;
}
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] delayBeforeRetry %lld ms", call->id, call->delayBeforeRetry.count()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] delayBeforeRetry %lld ms", TO_ULL(call->id), call->delayBeforeRetry.count()); }
// Remember result if there was an error and there was a Retry-After header
if (call->retryAfterCacheId != 0 &&
@ -395,7 +395,7 @@ void retry_http_call_until_done(
call->firstRequestStartTime = requestStartTime;
}
call->retryIterationNumber++;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Iteration %d", call->id, call->retryIterationNumber); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Iteration %d", TO_ULL(call->id), call->retryIterationNumber); }
http_retry_after_api_state apiState = httpSingleton->get_retry_state(call->retryAfterCacheId);
if (apiState.statusCode >= 400)
@ -404,7 +404,7 @@ void retry_http_call_until_done(
if (should_fast_fail(apiState, call, requestStartTime, &clearState))
{
HCHttpCallResponseSetStatusCode(call, apiState.statusCode);
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Fast fail %d", call->id, apiState.statusCode); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Fast fail %d", TO_ULL(call->id), apiState.statusCode); }
XAsyncComplete(retryContext->outerAsyncBlock, S_OK, 0);
return;
}
@ -453,7 +453,7 @@ void retry_http_call_until_done(
if (SUCCEEDED(callStatus) && http_call_should_retry(call, responseReceivedTime))
{
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Retry after %lld ms", call->id, call->delayBeforeRetry.count()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerformExecute [ID %llu] Retry after %lld ms", TO_ULL(call->id), call->delayBeforeRetry.count()); }
clear_http_call_response(call);
retry_http_call_until_done(std::move(retryContext));
}
@ -496,7 +496,7 @@ try
return E_INVALIDARG;
}
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] uri: %s", call->id, call->url.c_str()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallPerform [ID %llu] uri: %s", TO_ULL(call->id), call->url.c_str()); }
call->performCalled = true;
auto retryContext = http_allocate_unique<retry_context>();

Просмотреть файл

@ -27,7 +27,7 @@ try
call->method = method;
call->url = url;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetUrl [ID %llu]: method=%s url=%s", call->id, method, url); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetUrl [ID %llu]: method=%s url=%s", TO_ULL(call->id), method, url); }
return S_OK;
}
@ -77,7 +77,7 @@ try
call->requestBodyBytes.assign(requestBodyBytes, requestBodyBytes + requestBodySize);
call->requestBodyString.clear();
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRequestBodyBytes [ID %llu]: requestBodySize=%lu", call->id, static_cast<unsigned long>(requestBodySize)); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRequestBodyBytes [ID %llu]: requestBodySize=%lu", TO_ULL(call->id), static_cast<unsigned long>(requestBodySize)); }
return S_OK;
}
CATCH_RETURN()
@ -166,7 +166,7 @@ try
call->requestHeaders[headerName] = headerValue;
if (allowTracing && call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetHeader [ID %llu]: %s=%s", call->id, headerName, headerValue); }
if (allowTracing && call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetHeader [ID %llu]: %s=%s", TO_ULL(call->id), headerName, headerValue); }
return S_OK;
}
CATCH_RETURN()
@ -263,7 +263,7 @@ try
RETURN_IF_PERFORM_CALLED(call);
call->retryAfterCacheId = retryAfterCacheId;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRetryCacheId [ID %llu]: retryAfterCacheId=%d", call->id, retryAfterCacheId); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRetryCacheId [ID %llu]: retryAfterCacheId=%d", TO_ULL(call->id), retryAfterCacheId); }
}
return S_OK;
}
@ -289,7 +289,7 @@ try
RETURN_IF_PERFORM_CALLED(call);
call->retryAllowed = retryAllowed;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRetryAllowed [ID %llu]: retryAllowed=%s", call->id, retryAllowed ? "true" : "false"); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetRetryAllowed [ID %llu]: retryAllowed=%s", TO_ULL(call->id), retryAllowed ? "true" : "false"); }
}
return S_OK;
}
@ -362,7 +362,7 @@ try
RETURN_IF_PERFORM_CALLED(call);
call->timeoutInSeconds = timeoutInSeconds;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetTimeout [ID %llu]: timeoutInSeconds=%u", call->id, timeoutInSeconds); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallRequestSetTimeout [ID %llu]: timeoutInSeconds=%u", TO_ULL(call->id), timeoutInSeconds); }
}
return S_OK;

Просмотреть файл

@ -22,7 +22,7 @@ try
if (call->responseString.empty())
{
call->responseString = http_internal_string(reinterpret_cast<char const*>(call->responseBodyBytes.data()), call->responseBodyBytes.size());
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseGetResponseString [ID %llu]: responseString=%.2048s", call->id, call->responseString.c_str()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseGetResponseString [ID %llu]: responseString=%.2048s", TO_ULL(call->id), call->responseString.c_str()); }
}
*responseString = call->responseString.c_str();
return S_OK;
@ -88,7 +88,7 @@ try
call->responseBodyBytes.assign(bodyBytes, bodyBytes + bodySize);
call->responseString.clear();
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseBodyBytes [ID %llu]: bodySize=%zu", call->id, bodySize); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseBodyBytes [ID %llu]: bodySize=%zu", TO_ULL(call->id), bodySize); }
return S_OK;
}
CATCH_RETURN()
@ -109,7 +109,7 @@ try
call->responseBodyBytes.insert(call->responseBodyBytes.end(), bodyBytes, bodyBytes + bodySize);
call->responseString.clear();
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseAppendResponseBodyBytes [ID %llu]: bodySize=%zu (total=%llu)", call->id, bodySize, call->responseBodyBytes.size()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseAppendResponseBodyBytes [ID %llu]: bodySize=%zu (total=%llu)", TO_ULL(call->id), bodySize, call->responseBodyBytes.size()); }
return S_OK;
}
CATCH_RETURN()
@ -144,7 +144,7 @@ try
}
call->statusCode = statusCode;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetStatusCode [ID %llu]: statusCode=%u", call->id, statusCode); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetStatusCode [ID %llu]: statusCode=%u", TO_ULL(call->id), statusCode); }
return S_OK;
}
CATCH_RETURN()
@ -183,7 +183,7 @@ try
call->networkErrorCode = networkErrorCode;
call->platformNetworkErrorCode = platformNetworkErrorCode;
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetErrorCode [ID %llu]: errorCode=%08X (%08X)", call->id, networkErrorCode, platformNetworkErrorCode); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetErrorCode [ID %llu]: errorCode=%08X (%08X)", TO_ULL(call->id), networkErrorCode, platformNetworkErrorCode); }
return S_OK;
}
CATCH_RETURN()
@ -222,7 +222,7 @@ try
{
HC_TRACE_INFORMATION(HTTPCLIENT,
"HCHttpCallResponseSetErrorMessage [ID %llu]: errorMessage=%s",
call->id,
TO_ULL(call->id),
platformNetworkErrorMessage);
}
return S_OK;
@ -350,13 +350,13 @@ try
newHeaderValue.append(", ");
newHeaderValue.append(headerValue, headerValue + valueSize);
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseHeader [ID %llu]: Duplicated header %s=%s", call->id, name.c_str(), newHeaderValue.c_str()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseHeader [ID %llu]: Duplicated header %s=%s", TO_ULL(call->id), name.c_str(), newHeaderValue.c_str()); }
}
else
{
http_internal_string value{ headerValue, headerValue + valueSize };
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseHeader [ID %llu]: %s=%s", call->id, name.c_str(), value.c_str()); }
if (call->traceCall) { HC_TRACE_INFORMATION(HTTPCLIENT, "HCHttpCallResponseSetResponseHeader [ID %llu]: %s=%s", TO_ULL(call->id), name.c_str(), value.c_str()); }
call->responseHeaders[name] = std::move(value);
}

Просмотреть файл

@ -25,7 +25,7 @@ STDAPI HCMockCallCreate(
HC_MOCK_CALL* call = new HC_MOCK_CALL{};
call->id = ++httpSingleton->m_lastId;
HC_TRACE_INFORMATION(HTTPCLIENT, "HCMockCallCreate [ID %llu]", call->id);
HC_TRACE_INFORMATION(HTTPCLIENT, "HCMockCallCreate [ID %llu]", TO_ULL(call->id));
*callHandle = call;
return S_OK;

Просмотреть файл

@ -381,7 +381,7 @@ private:
m_con = con;
if (ec.value() != 0)
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp get_connection failed", m_hcWebsocketHandle->id);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp get_connection failed", TO_ULL(m_hcWebsocketHandle->id));
return E_FAIL;
}
@ -401,7 +401,7 @@ private:
con->add_subprotocol(m_subprotocol.data(), ec);
if (ec.value())
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: add_subprotocol failed", m_hcWebsocketHandle->id);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: add_subprotocol failed", TO_ULL(m_hcWebsocketHandle->id));
return E_FAIL;
}
}
@ -412,7 +412,7 @@ private:
con->set_proxy(m_hcWebsocketHandle->ProxyUri().data(), ec);
if (ec)
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp set_proxy failed", m_hcWebsocketHandle->id);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp set_proxy failed", TO_ULL(m_hcWebsocketHandle->id));
return E_FAIL;
}
}
@ -428,7 +428,7 @@ private:
con->set_proxy(proxyUri.FullPath().data(), ec);
if (ec)
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp set_proxy failed", m_hcWebsocketHandle->id);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: wspp set_proxy failed", TO_ULL(m_hcWebsocketHandle->id));
return E_FAIL;
}
}
@ -931,7 +931,7 @@ HRESULT CALLBACK Internal_HCWebSocketDisconnect(
return E_UNEXPECTED;
}
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", TO_ULL(websocket->id));
return wsppSocket->close(closeStatus);
}

Просмотреть файл

@ -233,7 +233,7 @@ public:
sendContext->message = std::move(m_outgoingMessageQueue.front());
m_outgoingMessageQueue.pop();
}
HC_TRACE_VERBOSE(WEBSOCKET, "[WinHttp][ID %llu] sending message[ID %llu]...", m_hcWebsocketHandle->id, sendContext->message.id);
HC_TRACE_VERBOSE(WEBSOCKET, "[WinHttp][ID %llu] sending message[ID %llu]...", TO_ULL(m_hcWebsocketHandle->id), sendContext->message.id);
auto rawSendContext = shared_ptr_cache::store(sendContext);
if (rawSendContext == nullptr)
{
@ -261,7 +261,7 @@ public:
return E_HC_NOT_INITIALISED;
}
HRESULT hr = sendMsgContext->pThis->send_msg_do_work(&sendMsgContext->message);
HC_TRACE_VERBOSE(WEBSOCKET, "[WinHttp][ID %llu] send message[ID %llu] completed: hr=%08X", sendMsgContext->pThis->m_hcWebsocketHandle->id, sendMsgContext->message.id, hr);
HC_TRACE_VERBOSE(WEBSOCKET, "[WinHttp][ID %llu] send message[ID %llu] completed: hr=%08X", TO_ULL(sendMsgContext->pThis->m_hcWebsocketHandle->id), sendMsgContext->message.id, hr);
return hr;
}
@ -408,7 +408,7 @@ HRESULT CALLBACK Internal_HCWebSocketDisconnect(
return E_UNEXPECTED;
}
httpSocket->m_hcWebsocketHandle = websocket;
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", TO_ULL(websocket->id));
return httpSocket->disconnect_websocket(closeStatus);
}

Просмотреть файл

@ -96,7 +96,7 @@ void ReceiveContext::OnReceive(MessageWebSocket^ sender, MessageWebSocketMessage
std::string payload;
payload.resize(len);
reader->ReadBytes(Platform::ArrayReference<uint8_t>(reinterpret_cast<uint8 *>(&payload[0]), len));
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: receieved msg [%s]", m_websocket->id, payload.c_str());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: receieved msg [%s]", TO_ULL(m_websocket->id), payload.c_str());
HCWebSocketMessageFunction messageFunc = nullptr;
HCWebSocketBinaryMessageFunction binaryMessageFunc = nullptr;
@ -129,7 +129,7 @@ void ReceiveContext::OnReceive(MessageWebSocket^ sender, MessageWebSocketMessage
void ReceiveContext::OnClosed(IWebSocket^ sender, WebSocketClosedEventArgs^ args)
{
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: on closed event triggered", m_websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: on closed event triggered", TO_ULL(m_websocket->id));
std::shared_ptr<winrt_websocket_impl> websocketTask = std::dynamic_pointer_cast<winrt_websocket_impl>(m_websocket->impl);
if (websocketTask->m_connectClosing)
@ -180,7 +180,7 @@ HRESULT WebsocketConnectDoWork(
try
{
HCWebsocketHandle websocket = static_cast<HCWebsocketHandle>(executionRoutineContext);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Connect executing", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Connect executing", TO_ULL(websocket->id));
std::shared_ptr<winrt_websocket_impl> websocketTask = std::dynamic_pointer_cast<winrt_websocket_impl>(websocket->impl);
try
@ -207,7 +207,7 @@ try
websocketTask->m_messageWebSocket->SetRequestHeader(
Platform::StringReference(wHeaderName.c_str()),
Platform::StringReference(wHeaderValue.c_str()));
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Header %d [%s: %s]", websocket->id, i, headerName, headerValue);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Header %d [%s: %s]", TO_ULL(websocket->id), i, headerName, headerValue);
}
}
@ -215,7 +215,7 @@ try
for (const auto& value : protocols)
{
websocketTask->m_messageWebSocket->Control->SupportedProtocols->Append(Platform::StringReference(value.c_str()));
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Protocol [%S]", websocket->id, value.c_str());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Protocol [%S]", TO_ULL(websocket->id), value.c_str());
}
websocketTask->m_context = ref new ReceiveContext();
@ -227,7 +227,7 @@ try
websocketTask->m_messageWebSocket->MessageReceived += ref new TypedEventHandler<MessageWebSocket^, MessageWebSocketMessageReceivedEventArgs^>(websocketTask->m_context, &ReceiveContext::OnReceive);
websocketTask->m_messageWebSocket->Closed += ref new TypedEventHandler<IWebSocket^, WebSocketClosedEventArgs^>(websocketTask->m_context, &ReceiveContext::OnClosed);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: connecting to %s", websocket->id, websocket->Uri().c_str());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: connecting to %s", TO_ULL(websocket->id), websocket->Uri().c_str());
websocketTask->m_connectAsyncOp = websocketTask->m_messageWebSocket->ConnectAsync(cxUri);
@ -260,7 +260,7 @@ try
if (FAILED(websocketTask->m_connectAsyncOpResult))
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: connect failed 0x%0.8x", websocket->id, websocketTask->m_connectAsyncOpResult);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: connect failed 0x%0.8x", TO_ULL(websocket->id), websocketTask->m_connectAsyncOpResult);
try
{
@ -275,7 +275,7 @@ try
}
else
{
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu] connect complete", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu] connect complete", TO_ULL(websocket->id));
}
XAsyncComplete(asyncBlock, S_OK, sizeof(WebSocketCompletionResult));
@ -294,7 +294,7 @@ try
{
}
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: ConnectAsync failed = 0x%0.8x", websocketTask->m_websocketHandle->id, e->HResult);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: ConnectAsync failed = 0x%0.8x", TO_ULL(websocketTask->m_websocketHandle->id), e->HResult);
return e->HResult;
}
@ -385,7 +385,7 @@ HRESULT CALLBACK Internal_HCWebSocketSendMessageAsync(
{
std::lock_guard<std::recursive_mutex> lock(websocketTask->m_outgoingMessageQueueLock);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: send msg queue size: %zu", websocketTask->m_websocketHandle->id, websocketTask->m_outgoingMessageQueue.size());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: send msg queue size: %zu", TO_ULL(websocketTask->m_websocketHandle->id), websocketTask->m_outgoingMessageQueue.size());
websocketTask->m_outgoingMessageQueue.push(msg);
}
@ -430,7 +430,7 @@ HRESULT CALLBACK Internal_HCWebSocketSendBinaryMessageAsync(
{
std::lock_guard<std::recursive_mutex> lock(websocketTask->m_outgoingMessageQueueLock);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: send msg queue size: %zu", websocketTask->m_websocketHandle->id, websocketTask->m_outgoingMessageQueue.size());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: send msg queue size: %zu", TO_ULL(websocketTask->m_websocketHandle->id), websocketTask->m_outgoingMessageQueue.size());
websocketTask->m_outgoingMessageQueue.push(msg);
}
@ -467,10 +467,10 @@ try
try
{
auto websocket = websocketTask->m_websocketHandle;
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Send message executing", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Send message executing", TO_ULL(websocket->id));
auto msg = sendMsgContext->nextMessage;
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] [%s]", websocket->id, msg->m_id, msg->m_message.c_str());
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] [%s]", TO_ULL(websocket->id), TO_ULL(msg->m_id), msg->m_message.c_str());
if (!msg->m_message.empty())
{
@ -494,7 +494,7 @@ try
{
msg->m_storeAsyncOpStatus = status;
unsigned int result = asyncOp->GetResults();
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] send complete = %d", websocketTask->m_websocketHandle->id, msg->m_id, result);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] send complete = %d", TO_ULL(websocketTask->m_websocketHandle->id), msg->m_id, result);
msg->m_storeAsyncResult = result;
}
catch (Platform::Exception^ ex)
@ -508,7 +508,7 @@ try
if (FAILED(msg->m_storeAsyncResult))
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] send failed = 0x%0.8x", websocketTask->m_websocketHandle->id, msg->m_id, msg->m_storeAsyncResult);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Message [ID %llu] send failed = 0x%0.8x", TO_ULL(websocketTask->m_websocketHandle->id), msg->m_id, msg->m_storeAsyncResult);
}
XAsyncComplete(asyncBlock, msg->m_storeAsyncResult, sizeof(WebSocketCompletionResult));
MessageWebSocketSendMessage(websocketTask);
@ -516,7 +516,7 @@ try
}
catch (Platform::Exception^ e)
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Send failed = 0x%0.8x", websocketTask->m_websocketHandle->id, e->HResult);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Send failed = 0x%0.8x", TO_ULL(websocketTask->m_websocketHandle->id), e->HResult);
bool expectedSendInProgress = true;
websocketTask->m_outgoingMessageSendInProgress.compare_exchange_strong(expectedSendInProgress, false);
return e->HResult;
@ -548,7 +548,7 @@ HRESULT WebsockSendMessageGetResult(_In_ const XAsyncProviderData* data)
return E_INVALIDARG;
}
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: GetResult ", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: GetResult ", TO_ULL(websocket->id));
WebSocketCompletionResult result = {};
result.websocket = websocket;
@ -638,14 +638,14 @@ HRESULT CALLBACK Internal_HCWebSocketDisconnect(
return E_UNEXPECTED;
}
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "Websocket [ID %llu]: disconnecting", TO_ULL(websocket->id));
try
{
websocketTask->m_messageWebSocket->Close(static_cast<unsigned short>(closeStatus), nullptr);
}
catch (Platform::Exception^ e)
{
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Close failed = 0x%0.8x", websocketTask->m_websocketHandle->id, e->HResult);
HC_TRACE_ERROR(WEBSOCKET, "Websocket [ID %llu]: Close failed = 0x%0.8x", TO_ULL(websocketTask->m_websocketHandle->id), e->HResult);
return e->HResult;
}

Просмотреть файл

@ -134,13 +134,13 @@ HRESULT HC_WEBSOCKET::Connect(
}
catch (...)
{
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketConnect [ID %llu]: failed", id);
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketConnect [ID %llu]: failed", TO_ULL(id));
return E_FAIL;
}
}
else
{
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Connect [ID %llu]: Websocket connect implementation not found!", id);
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Connect [ID %llu]: Websocket connect implementation not found!", TO_ULL(id));
return E_UNEXPECTED;
}
}
@ -200,13 +200,13 @@ HRESULT HC_WEBSOCKET::Send(
}
catch (...)
{
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketSendMessage [ID %llu]: failed", id);
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketSendMessage [ID %llu]: failed", TO_ULL(id));
return E_FAIL;
}
}
else
{
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Send [ID %llu]: Websocket send implementation not found!", id);
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Send [ID %llu]: Websocket send implementation not found!", TO_ULL(id));
return E_UNEXPECTED;
}
return S_OK;
@ -241,13 +241,13 @@ HRESULT HC_WEBSOCKET::SendBinary(
}
catch (...)
{
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketSendBinaryMessageAsync [ID %llu]: failed", id);
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketSendBinaryMessageAsync [ID %llu]: failed", TO_ULL(id));
return E_FAIL;
}
}
else
{
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Send [ID %llu]: Websocket send implementation not found!", id);
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Send [ID %llu]: Websocket send implementation not found!", TO_ULL(id));
return E_UNEXPECTED;
}
}
@ -282,13 +282,13 @@ HRESULT HC_WEBSOCKET::Disconnect()
}
catch (...)
{
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketClose [ID %llu]: failed", id);
HC_TRACE_ERROR(WEBSOCKET, "HCWebSocketClose [ID %llu]: failed", TO_ULL(id));
return E_FAIL;
}
}
else
{
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Disconnect [ID %llu]: Websocket disconnect implementation not found!", id);
HC_TRACE_ERROR(WEBSOCKET, "HC_WEBSOCKET::Disconnect [ID %llu]: Websocket disconnect implementation not found!", TO_ULL(id));
return E_UNEXPECTED;
}
}
@ -502,7 +502,7 @@ try
functionContext
);
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketCreate [ID %llu]", socket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketCreate [ID %llu]", TO_ULL(socket->id));
socket->AddClientRef();
*websocket = socket.get();
@ -615,7 +615,7 @@ try
return nullptr;
}
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketDuplicateHandle [ID %llu]", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketDuplicateHandle [ID %llu]", TO_ULL(websocket->id));
websocket->AddClientRef();
return websocket;
@ -633,7 +633,7 @@ try
return E_INVALIDARG;
}
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketCloseHandle [ID %llu]", websocket->id);
HC_TRACE_INFORMATION(WEBSOCKET, "HCWebSocketCloseHandle [ID %llu]", TO_ULL(websocket->id));
websocket->DecClientRef();
return S_OK;