wsamanager 분리

This commit is contained in:
2025-04-26 17:21:54 +09:00
parent 81d912cc5e
commit 1418cf6880
5 changed files with 28 additions and 16 deletions

View File

@@ -4,20 +4,7 @@
namespace Chattr {
Socket::Socket() {
#ifdef _WIN32
WSADATA wsa;
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
log::critical("WSAStartup()");
#endif
}
Socket::Socket(int domain, int type, int protocol) {
#ifdef _WIN32
WSADATA wsa;
if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
log::critical("WSAStartup()");
#endif
init(domain, type, protocol);
}
@@ -42,8 +29,7 @@ void Socket::destruct() {
if (!valid_)
return;
#ifdef _WIN32
closesocket(sock_);
WSACleanup();
::closesocket(sock_);
#elif __linux__
::close(sock_);
#endif