Fix sending to localhost ips.

This commit is contained in:
Mr_Goldberg 2022-05-29 15:46:31 -04:00
parent 03426b217d
commit 9c7499aa27
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 4 additions and 1 deletions

View File

@ -1126,9 +1126,12 @@ void Networking::setAppID(uint32 appid)
bool Networking::sendToIPPort(Common_Message *msg, uint32 ip, uint16 port, bool reliable)
{
bool is_local_ip = ((ip >> 24) == 0x7F);
uint32_t local_ip = getIP(ids.front());
PRINT_DEBUG("sendToIPPort %X %u %X\n", ip, is_local_ip, local_ip);
//TODO: actually send to ip/port
for (auto &conn: connections) {
if (ntohl(conn.tcp_ip_port.ip) == ip) {
if (ntohl(conn.tcp_ip_port.ip) == ip || (is_local_ip && ntohl(conn.tcp_ip_port.ip) == local_ip)) {
for (auto &steam_id : conn.ids) {
msg->set_dest_id(steam_id.ConvertToUint64());
sendTo(msg, reliable, &conn);