| 6 | #include <base/system.h> |
| 7 | |
| 8 | bool 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 | |
| 35 | void CNetConsole::SetCallbacks(NETFUNC_NEWCLIENT_CON pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser) |
| 36 | { |
nothing calls this directly
no test coverage detected