You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate unique local addresses (IPv6 addresses) for debug dummies so address-based functions work with debug dummies. Every debug dummy's ULA has a randomly generated global ID such that debug dummy addresses are most likely unique. The ULA's subnet ID is set to a constant value. The ULA's interface ID is set to the dummy's client ID. See https://en.wikipedia.org/wiki/Unique_local_address for details about the format. The port is generated randomly in the same way that normal clients select their port.
Change the `const char (*::CNetServer::ClientAddrString(int ClientID) const)[NETADDR_MAXSTRSIZE]` function signature to `const std::array<char, NETADDR_MAXSTRSIZE> &ClientAddrString(int ClientId, bool IncludePort) const` and change the `const char (*CNetConnection::PeerAddressString() const)[NETADDR_MAXSTRSIZE]` function signature to `const std::array<char, NETADDR_MAXSTRSIZE> &PeerAddressString(bool IncludePort) const` to optionally include the port and because a reference to an `std::array` is more readable then a pointer/reference to a C-array. The address string is now cached separately with and without port by `CNetConnection`.
Add the `CNetConnection::SetPeerAddr` and `CNetConnection::ClearPeerAddr` functions to avoid duplicate code. Fix the peer address string not being initialized for 0.7 connections, though this is currently unused from the client-side so it had no effect.
Change the `void IServer::GetClientAddr(int ClientId, NETADDR *pAddr) const` function signature to `const NETADDR *ClientAddr(int ClientId) const`. This simplifies the usage as most address-based functions take pointers to `NETADDR` as arguments. Use this function consistently instead of the `CNetServer::ClientAddr` function, as the `IServer::ClientAddr` function has assertions and returns the generated ULA for debug dummies.
Change the `void IServer::GetClientAddr(int ClientId, char *pAddrStr, int Size) const` function signature to `const std::array<char, NETADDR_MAXSTRSIZE> &ClientAddrStringImpl(int ClientId, bool IncludePort) const` and add the `inline const char *ClientAddrString(int ClientId, bool IncludePort) const` wrapper function. This also simplifies the usage in most cases while retaining the static size information for the address strings. These functions can return the string with and without port, whereas before the string was always returned without port. Use this function consistently instead of the `CNetServer::ClientAddrString` function and instead of the `net_addr_str` function together with the `IServer::GetClientAddr` function, as the `IServer::ClientAddrString` function has assertions and returns the generated ULA strings for debug dummies. This should also slightly improves performance as the cached address strings are thereby used in all cases. Note that the `CNetServer::ClientAddrString` function previously returned the address string with port, whereas the `IServer::GetClientAddr` function returned the address string without port.
Compare `NETADDR`s directly without ports instead of converting to strings without ports when counting votes.
Closesddnet#9554.
0 commit comments