diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-11 19:09:54 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-20 23:44:59 +0800 |
| commit | 7950f626f9b47761864c7f27eecf77c7204e6828 (patch) | |
| tree | 2f6830148bd2d546d29defa583893e4a5807d080 /src/session.cpp | |
| parent | e702fc9cdbe9808a8cc7a60bf3c414f874d81d02 (diff) | |
bump: compile_commands
Diffstat (limited to 'src/session.cpp')
| -rw-r--r-- | src/session.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/session.cpp b/src/session.cpp index 64dbda1..b37d896 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -3,20 +3,21 @@ #include "log.hpp" #include "server.hpp" #include "sessionManager.hpp" +#include <arpa/inet.h> #include <cerrno> #include <cstring> #include <sys/socket.h> -#include <arpa/inet.h> -CSession::CSession() : m_addrLen(sizeof(m_addr)) { - m_sockfd = Hyprutils::OS::CFileDescriptor{accept(g_pServer->getSocket()->get(), reinterpret_cast<sockaddr *>(&m_addr), &m_addrLen)}; // if this is in the init list, it will run before m_addrLen, so it won't work :/ +CSession::CSession() + : m_addrLen(sizeof(m_addr)) { + m_sockfd = Hyprutils::OS::CFileDescriptor{accept(g_pServer->getSocket()->get(), reinterpret_cast<sockaddr *>(&m_addr), &m_addrLen)}; // if this is in the init list, it will run before m_addrLen, so it won't work :/ if (!m_sockfd.isValid()) throw std::runtime_error("session: Failed to create socket"); - inet_ntop(AF_INET, &m_addr.sin_addr, m_ip, INET_ADDRSTRLEN); - m_port = ntohs(m_addr.sin_port); - log(TRACE, "session({}): connected on port {}", m_ip, m_port); + inet_ntop(AF_INET, &m_addr.sin_addr, m_ip, INET_ADDRSTRLEN); + m_port = ntohs(m_addr.sin_port); + log(TRACE, "session({}): connected on port {}", m_ip, m_port); log(TRACE, "session: initialized"); } |
