MCPcopy Create free account
hub / github.com/ddnet/ddnet / Open

Method Open

src/engine/shared/network_console.cpp:8–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <base/system.h>
7
8bool CNetConsole::Open(NETADDR BindAddr, CNetBan *pNetBan)
9{
10 // zero out the whole structure
11 *this = CNetConsole{};
12 m_pNetBan = pNetBan;
13
14 m_Socket = net_tcp_create(BindAddr);
15 if(!m_Socket)
16 {
17 return false;
18 }
19 if(net_tcp_listen(m_Socket, NET_MAX_CONSOLE_CLIENTS) != 0 ||
20 net_set_non_blocking(m_Socket) != 0)
21 {
22 net_tcp_close(m_Socket);
23 m_Socket = nullptr;
24 return false;
25 }
26
27 for(auto &Slot : m_aSlots)
28 {
29 Slot.m_Connection.Reset();
30 }
31
32 return true;
33}
34
35void CNetConsole::SetCallbacks(NETFUNC_NEWCLIENT_CON pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser)
36{

Callers

nothing calls this directly

Calls 5

net_tcp_createFunction · 0.85
net_tcp_listenFunction · 0.85
net_set_non_blockingFunction · 0.85
net_tcp_closeFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected