aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-05-05 20:24:41 +0200
committerKawe Mazidjatari <48657826+Mauler125@users.noreply.github.com>2022-05-05 20:24:41 +0200
commit7091699fedf0bd1a56526af54256a09652539a74 (patch)
tree3db1ecb8e175aeea36a2a10845edf93dd230b887
parent958c08c005e33ea83b90358f74cf13ab5fa6c279 (diff)
downloadNorthstarLauncher-7091699fedf0bd1a56526af54256a09652539a74.tar.gz
NorthstarLauncher-7091699fedf0bd1a56526af54256a09652539a74.zip
Fix clang format
-rw-r--r--NorthstarDedicatedTest/igameserverdata.h14
-rw-r--r--NorthstarDedicatedTest/socketcreator.cpp48
-rw-r--r--NorthstarDedicatedTest/socketcreator.h15
3 files changed, 52 insertions, 25 deletions
diff --git a/NorthstarDedicatedTest/igameserverdata.h b/NorthstarDedicatedTest/igameserverdata.h
index c3781d46..678d1e90 100644
--- a/NorthstarDedicatedTest/igameserverdata.h
+++ b/NorthstarDedicatedTest/igameserverdata.h
@@ -30,13 +30,13 @@ enum class ServerDataResponseType_t : int
class CConnectedNetConsoleData
{
public:
- SocketHandle_t m_hSocket{};
- int m_nCharsInCommandBuffer{};
- char m_pszInputCommandBuffer[MAX_NETCONSOLE_INPUT_LEN]{};
- bool m_bAuthorized{}; // Set to true after netconsole successfully authed.
- bool m_bInputOnly{}; // If set, don't send spew to this net console.
- int m_nFailedAttempts{}; // Num failed authentication attempts.
- int m_nIgnoredMessage{}; // Count how many times client ignored the no-auth message.
+ SocketHandle_t m_hSocket {};
+ int m_nCharsInCommandBuffer {};
+ char m_pszInputCommandBuffer[MAX_NETCONSOLE_INPUT_LEN] {};
+ bool m_bAuthorized {}; // Set to true after netconsole successfully authed.
+ bool m_bInputOnly {}; // If set, don't send spew to this net console.
+ int m_nFailedAttempts {}; // Num failed authentication attempts.
+ int m_nIgnoredMessage {}; // Count how many times client ignored the no-auth message.
CConnectedNetConsoleData(SocketHandle_t hSocket = -1)
{
diff --git a/NorthstarDedicatedTest/socketcreator.cpp b/NorthstarDedicatedTest/socketcreator.cpp
index 0fb51821..03b5b76f 100644
--- a/NorthstarDedicatedTest/socketcreator.cpp
+++ b/NorthstarDedicatedTest/socketcreator.cpp
@@ -14,12 +14,18 @@
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
-CSocketCreator::CSocketCreator(void) { m_hListenSocket = -1; }
+CSocketCreator::CSocketCreator(void)
+{
+ m_hListenSocket = -1;
+}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
-CSocketCreator::~CSocketCreator(void) { DisconnectSocket(); }
+CSocketCreator::~CSocketCreator(void)
+{
+ DisconnectSocket();
+}
//-----------------------------------------------------------------------------
// Purpose: accept new connections and walk open sockets and handle any incoming data
@@ -37,7 +43,7 @@ void CSocketCreator::RunFrame(void)
//-----------------------------------------------------------------------------
void CSocketCreator::ProcessAccept(void)
{
- sockaddr_storage inClient{};
+ sockaddr_storage inClient {};
int nLengthAddr = sizeof(inClient);
int newSocket = ::accept(m_hListenSocket, reinterpret_cast<sockaddr*>(&inClient), &nLengthAddr);
if (newSocket == -1)
@@ -127,7 +133,7 @@ bool CSocketCreator::CreateListenSocket(const CNetAdr2& netAdr2, bool bListenOnA
return false;
}
- sockaddr_storage sadr{};
+ sockaddr_storage sadr {};
m_ListenAddress.ToSockadr(&sadr);
int results = ::bind(m_hListenSocket, reinterpret_cast<sockaddr*>(&sadr), m_ListenAddress.GetSize());
@@ -201,8 +207,8 @@ int CSocketCreator::ConnectSocket(const CNetAdr2& netAdr2, bool bSingleSocket)
return SOCKET_ERROR;
}
- fd_set writefds{};
- timeval tv{};
+ fd_set writefds {};
+ timeval tv {};
tv.tv_usec = 0;
tv.tv_sec = 1;
@@ -285,29 +291,47 @@ void CSocketCreator::CloseAllAcceptedSockets(void)
//-----------------------------------------------------------------------------
// Purpose: returns true if the listening socket is created and listening
//-----------------------------------------------------------------------------
-bool CSocketCreator::IsListening(void) const { return m_hListenSocket != -1; }
+bool CSocketCreator::IsListening(void) const
+{
+ return m_hListenSocket != -1;
+}
//-----------------------------------------------------------------------------
// Purpose: returns true if the socket would block because of the last socket command
//-----------------------------------------------------------------------------
-bool CSocketCreator::IsSocketBlocking(void) const { return (WSAGetLastError() == WSAEWOULDBLOCK); }
+bool CSocketCreator::IsSocketBlocking(void) const
+{
+ return (WSAGetLastError() == WSAEWOULDBLOCK);
+}
//-----------------------------------------------------------------------------
// Purpose: returns accepted socket count
//-----------------------------------------------------------------------------
-int CSocketCreator::GetAcceptedSocketCount(void) const { return m_hAcceptedSockets.size(); }
+int CSocketCreator::GetAcceptedSocketCount(void) const
+{
+ return m_hAcceptedSockets.size();
+}
//-----------------------------------------------------------------------------
// Purpose: returns accepted socket handle
//-----------------------------------------------------------------------------
-SocketHandle_t CSocketCreator::GetAcceptedSocketHandle(int nIndex) const { return m_hAcceptedSockets[nIndex].m_hSocket; }
+SocketHandle_t CSocketCreator::GetAcceptedSocketHandle(int nIndex) const
+{
+ return m_hAcceptedSockets[nIndex].m_hSocket;
+}
//-----------------------------------------------------------------------------
// Purpose: returns accepted socket address
//-----------------------------------------------------------------------------
-const CNetAdr2& CSocketCreator::GetAcceptedSocketAddress(int nIndex) const { return m_hAcceptedSockets[nIndex].m_Address; }
+const CNetAdr2& CSocketCreator::GetAcceptedSocketAddress(int nIndex) const
+{
+ return m_hAcceptedSockets[nIndex].m_Address;
+}
//-----------------------------------------------------------------------------
// Purpose: returns accepted socket data
//-----------------------------------------------------------------------------
-CConnectedNetConsoleData* CSocketCreator::GetAcceptedSocketData(int nIndex) const { return m_hAcceptedSockets[nIndex].m_pData; }
+CConnectedNetConsoleData* CSocketCreator::GetAcceptedSocketData(int nIndex) const
+{
+ return m_hAcceptedSockets[nIndex].m_pData;
+}
diff --git a/NorthstarDedicatedTest/socketcreator.h b/NorthstarDedicatedTest/socketcreator.h
index c4517ef6..018bd0ab 100644
--- a/NorthstarDedicatedTest/socketcreator.h
+++ b/NorthstarDedicatedTest/socketcreator.h
@@ -39,16 +39,19 @@ class CSocketCreator
public:
struct AcceptedSocket_t
{
- SocketHandle_t m_hSocket{};
- CNetAdr2 m_Address{};
+ SocketHandle_t m_hSocket {};
+ CNetAdr2 m_Address {};
CConnectedNetConsoleData* m_pData = nullptr;
- bool operator==(const AcceptedSocket_t& rhs) const { return (m_Address.CompareAdr(rhs.m_Address, false) == 0); }
+ bool operator==(const AcceptedSocket_t& rhs) const
+ {
+ return (m_Address.CompareAdr(rhs.m_Address, false) == 0);
+ }
};
- std::vector<AcceptedSocket_t> m_hAcceptedSockets{};
- SocketHandle_t m_hListenSocket{}; // Used to accept connections.
- CNetAdr2 m_ListenAddress{}; // Address used to listen on.
+ std::vector<AcceptedSocket_t> m_hAcceptedSockets {};
+ SocketHandle_t m_hListenSocket {}; // Used to accept connections.
+ CNetAdr2 m_ListenAddress {}; // Address used to listen on.
private:
enum