| 39 | 0x00, 0x05}; |
| 40 | |
| 41 | bool CNetServer::Open(NETADDR BindAddr, CNetBan *pNetBan, int MaxClients, int MaxClientsPerIp) |
| 42 | { |
| 43 | // zero out the whole structure |
| 44 | this->~CNetServer(); |
| 45 | new(this) CNetServer{}; |
| 46 | |
| 47 | // open socket |
| 48 | m_Socket = net_udp_create(BindAddr); |
| 49 | if(!m_Socket) |
| 50 | return false; |
| 51 | |
| 52 | m_Address = BindAddr; |
| 53 | m_pNetBan = pNetBan; |
| 54 | |
| 55 | m_MaxClients = std::clamp(MaxClients, 1, (int)NET_MAX_CLIENTS); |
| 56 | m_MaxClientsPerIp = MaxClientsPerIp; |
| 57 | |
| 58 | m_VConnNum = 0; |
| 59 | m_VConnFirst = 0; |
| 60 | |
| 61 | secure_random_fill(m_aSecurityTokenSeed, sizeof(m_aSecurityTokenSeed)); |
| 62 | |
| 63 | for(auto &Slot : m_aSlots) |
| 64 | Slot.m_Connection.Init(m_Socket, true); |
| 65 | |
| 66 | return true; |
| 67 | } |
| 68 | |
| 69 | int CNetServer::SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser) |
| 70 | { |
nothing calls this directly
no test coverage detected