From f48421899f8cb3389afac810857becf32be6d33e Mon Sep 17 00:00:00 2001 From: sauerbraten Date: Thu, 24 Mar 2022 22:25:18 +0100 Subject: [PATCH] fix proxy_setip.patch closes #52 --- patches/proxy_setip.patch | 2 +- src/engine/server.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/proxy_setip.patch b/patches/proxy_setip.patch index bd244e2..678f8c5 100644 --- a/patches/proxy_setip.patch +++ b/patches/proxy_setip.patch @@ -41,7 +41,7 @@ index 3017f57..4aa8d18 100644 -uint getclientip(int n) { return clients.inrange(n) && clients[n]->type==ST_TCPIP ? clients[n]->peer->address.host : 0; } +uint getclientip(int n) +{ -+ if(!clients.inrange(n) || clients[n]->type==ST_TCPIP) return 0; ++ if(!clients.inrange(n) || clients[n]->type!=ST_TCPIP) return 0; + return clients[n]->real.host ? clients[n]->real.host : clients[n]->peer->address.host; +} +int setclientrealip(int n, uint ip) diff --git a/src/engine/server.cpp b/src/engine/server.cpp index 92b074a..9aa7a3b 100644 --- a/src/engine/server.cpp +++ b/src/engine/server.cpp @@ -190,7 +190,7 @@ ENetPeer *getclientpeer(int i) { return clients.inrange(i) && clients[i]->type== int getnumclients() { return clients.length(); } uint getclientip(int n) { - if(!clients.inrange(n) || clients[n]->type==ST_TCPIP) return 0; + if(!clients.inrange(n) || clients[n]->type!=ST_TCPIP) return 0; return clients[n]->real.host ? clients[n]->real.host : clients[n]->peer->address.host; } int setclientrealip(int n, uint ip)