mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-27 14:08:39 +01:00
Fix sending to localhost ips.
This commit is contained in:
parent
03426b217d
commit
9c7499aa27
1 changed files with 4 additions and 1 deletions
|
@ -1126,9 +1126,12 @@ void Networking::setAppID(uint32 appid)
|
||||||
|
|
||||||
bool Networking::sendToIPPort(Common_Message *msg, uint32 ip, uint16 port, bool reliable)
|
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
|
//TODO: actually send to ip/port
|
||||||
for (auto &conn: connections) {
|
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) {
|
for (auto &steam_id : conn.ids) {
|
||||||
msg->set_dest_id(steam_id.ConvertToUint64());
|
msg->set_dest_id(steam_id.ConvertToUint64());
|
||||||
sendTo(msg, reliable, &conn);
|
sendTo(msg, reliable, &conn);
|
||||||
|
|
Loading…
Reference in a new issue