GIGA REFACTOR

This commit is contained in:
2022-03-02 18:51:42 +01:00
parent 553b2f6aad
commit 6df59b1487
92 changed files with 1807 additions and 1785 deletions

View File

@@ -14,10 +14,10 @@ namespace network {
TCPListener::TCPListener() {}
TCPListener::~TCPListener() {
destroy();
Destroy();
}
bool TCPListener::listen(uint16_t port, int maxConnections) {
bool TCPListener::Listen(uint16_t port, int maxConnections) {
if ((m_Handle = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
return false;
@@ -38,7 +38,7 @@ bool TCPListener::listen(uint16_t port, int maxConnections) {
return true;
}
bool TCPListener::accept(TCPSocket& newSocket) {
bool TCPListener::Accept(TCPSocket& newSocket) {
int addrlen = sizeof(newSocket.m_RemoteAddr);
if ((newSocket.m_Handle = ::accept(m_Handle, reinterpret_cast<sockaddr*>(&newSocket.m_RemoteAddr),
reinterpret_cast<socklen_t*>(&addrlen))) < 0)
@@ -48,21 +48,21 @@ bool TCPListener::accept(TCPSocket& newSocket) {
return true;
}
void TCPListener::destroy() {
void TCPListener::Destroy() {
if (m_Handle < 0)
::closesocket(m_Handle);
}
bool TCPListener::close() {
bool TCPListener::Close() {
if (::shutdown(m_Handle, SD_BOTH) == 0)
return true;
return false;
}
bool TCPListener::setBlocking(bool blocking) {
bool TCPListener::SetBlocking(bool blocking) {
unsigned long mode = blocking ? 0 : 1;
if (ioctlsocket(m_Handle, FIONBIO, &mode) < 0) {
if (::ioctlsocket(m_Handle, FIONBIO, &mode) < 0) {
return false;
}
return true;