Make sure winsock errors always gets logged

Make sure it always gets logged to the disk.
This commit is contained in:
Kawe Mazidjatari 2023-02-04 19:14:45 +01:00
parent 22d2cc5a7a
commit df7e80077f
3 changed files with 8 additions and 8 deletions

View File

@ -41,7 +41,7 @@ void SDK_Init()
Console_Init(); Console_Init();
#endif // !DEDICATED #endif // !DEDICATED
SpdLog_Init(); SpdLog_Init();
WinSock_Init(); // Initialize Winsock. Winsock_Init(); // Initialize Winsock.
for (size_t i = 0; i < SDK_ARRAYSIZE(R5R_EMBLEM); i++) for (size_t i = 0; i < SDK_ARRAYSIZE(R5R_EMBLEM); i++)
{ {
@ -76,7 +76,7 @@ void SDK_Shutdown()
curl_global_cleanup(); curl_global_cleanup();
WinSock_Shutdown(); Winsock_Shutdown();
Systems_Shutdown(); Systems_Shutdown();
WinSys_Shutdown(); WinSys_Shutdown();

View File

@ -234,21 +234,21 @@ void Systems_Shutdown()
// //
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
void WinSock_Init() void Winsock_Init()
{ {
WSAData wsaData{}; WSAData wsaData{};
int nError = ::WSAStartup(MAKEWORD(2, 2), &wsaData); int nError = ::WSAStartup(MAKEWORD(2, 2), &wsaData);
if (nError != 0) if (nError != 0)
{ {
spdlog::error("{:s}: Failed to start Winsock: ({:s})\n", __FUNCTION__, NET_ErrorString(WSAGetLastError())); Error(eDLL_T::COMMON, NO_ERROR, "%s: Failed to start Winsock: (%s)\n", __FUNCTION__, NET_ErrorString(WSAGetLastError()));
} }
} }
void WinSock_Shutdown() void Winsock_Shutdown()
{ {
int nError = ::WSACleanup(); int nError = ::WSACleanup();
if (nError != 0) if (nError != 0)
{ {
spdlog::error("{:s}: Failed to stop Winsock: ({:s})\n", __FUNCTION__, NET_ErrorString(WSAGetLastError())); Error(eDLL_T::COMMON, NO_ERROR, "%s: Failed to stop Winsock: (%s)\n", __FUNCTION__, NET_ErrorString(WSAGetLastError()));
} }
} }
void QuerySystemInfo() void QuerySystemInfo()

View File

@ -6,8 +6,8 @@ void SDK_Shutdown();
void Systems_Init(); void Systems_Init();
void Systems_Shutdown(); void Systems_Shutdown();
void WinSock_Init(); void Winsock_Init();
void WinSock_Shutdown(); void Winsock_Shutdown();
void QuerySystemInfo(); void QuerySystemInfo();
void CheckCPU(); void CheckCPU();