Fix compilation

This commit is contained in:
momo5502
2025-01-12 08:43:34 +01:00
parent 8333c25f2c
commit dd226bd45a
3 changed files with 13 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
#include "tcp_client_socket.hpp"
#include <cassert>
namespace network
{
tcp_client_socket::tcp_client_socket(const int af)
@@ -7,9 +9,11 @@ namespace network
{
}
tcp_client_socket::tcp_client_socket(SOCKET s)
tcp_client_socket::tcp_client_socket(SOCKET s, const address& target)
: socket(s)
{
(void)target;
assert(this->get_target() == target);
}
tcp_client_socket::~tcp_client_socket()

View File

@@ -29,6 +29,6 @@ namespace network
private:
friend tcp_server_socket;
tcp_client_socket(SOCKET s);
tcp_client_socket(SOCKET s, const address& target);
};
}

View File

@@ -13,7 +13,13 @@ namespace network
address a{};
auto len = a.get_max_size();
return ::accept(this->get_socket(), &a.get_addr(), &len);
const auto s = ::accept(this->get_socket(), &a.get_addr(), &len);
if (s == INVALID_SOCKET)
{
return {};
}
return {s, a};
}
void tcp_server_socket::listen()