mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Fix cURL error logging for dedicated
Since this file no longer gets build along with the DLL project, but as a static lib instead, the 'DEDICATED' define no longer worked, and therefore this became broken after the CMake port. The 'CURLHandleError' helper function now takes a bool determining whether or not to log the error, and the caller disables it for dedicated (dedicated should only log the error once, this happens from within the caller class).
This commit is contained in:
parent
a8f7336d78
commit
e891d74656
@ -407,7 +407,8 @@ bool CPylon::QueryServer(const char* endpoint, const char* request,
|
||||
}
|
||||
|
||||
CURLcode res = CURLSubmitRequest(curl, sList);
|
||||
if (!CURLHandleError(curl, res, outMessage))
|
||||
if (!CURLHandleError(curl, res, outMessage,
|
||||
!IsDedicated(/* Errors are already shown for dedicated! */)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ CURL* CURLInitRequest(const char* remote, const char* request, string& outRespon
|
||||
CURLcode CURLSubmitRequest(CURL* curl, curl_slist*& slist);
|
||||
CURLINFO CURLRetrieveInfo(CURL* curl);
|
||||
|
||||
bool CURLHandleError(CURL* curl, CURLcode res, string& outMessage);
|
||||
bool CURLHandleError(CURL* curl, const CURLcode res, string& outMessage, const bool logError);
|
||||
void CURLFormatUrl(string& outUrl, const char* host, const char* api);
|
||||
|
||||
#endif // !TIER2_CURLUTILS_H
|
@ -76,13 +76,15 @@ CURLINFO CURLRetrieveInfo(CURL* curl)
|
||||
return status;
|
||||
}
|
||||
|
||||
bool CURLHandleError(CURL* curl, CURLcode res, string& outMessage)
|
||||
bool CURLHandleError(CURL* curl, const CURLcode res, string& outMessage, const bool logError)
|
||||
{
|
||||
if (res == CURLE_OK)
|
||||
return true;
|
||||
|
||||
const char* curlError = curl_easy_strerror(res);
|
||||
Error(eDLL_T::ENGINE, NO_ERROR, "CURL: %s\n", curlError);
|
||||
|
||||
if (logError)
|
||||
Error(eDLL_T::ENGINE, NO_ERROR, "CURL: %s\n", curlError);
|
||||
|
||||
outMessage = curlError;
|
||||
curl_easy_cleanup(curl);
|
||||
|
Loading…
x
Reference in New Issue
Block a user