diff options
| author | JMC47 <JMC4789@gmail.com> | 2021-03-05 05:28:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-05 05:28:31 -0500 |
| commit | fc86e554e03916c8f9144f8dba9048977fb21300 (patch) | |
| tree | 3a65bc268b5b8cd022766b6588c7dd805b09274d /Source/Core/Common/SocketContext.cpp | |
| parent | adcdeda372a37f93652c28131b58de93e40857d9 (diff) | |
| parent | 7d5052896df794ec6c15bedcf7fe54144b5e301c (diff) | |
Merge pull request #9559 from iwubcode/gdb-stub-raii
Common / Core: add raii object that cleans up WSA on destruction in gdb-stub
Diffstat (limited to 'Source/Core/Common/SocketContext.cpp')
| -rw-r--r-- | Source/Core/Common/SocketContext.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/Core/Common/SocketContext.cpp b/Source/Core/Common/SocketContext.cpp new file mode 100644 index 0000000000..e9174bc0d9 --- /dev/null +++ b/Source/Core/Common/SocketContext.cpp @@ -0,0 +1,22 @@ +// Copyright 2021 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Common/SocketContext.h" + +namespace Common +{ +#ifdef _WIN32 +SocketContext::SocketContext() +{ + static_cast<void>(WSAStartup(MAKEWORD(2, 2), &m_data)); +} +SocketContext::~SocketContext() +{ + WSACleanup(); +} +#else +SocketContext::SocketContext() = default; +SocketContext::~SocketContext() = default; +#endif +} // namespace Common |
