1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Cache client IP in RemoteClient so it can always be retrieved (#10887)

specifically: after the peer has already disappeared
This commit is contained in:
sfan5 2021-01-31 20:36:47 +01:00 committed by GitHub
parent 6e0e0324a4
commit 112a6adb10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 98 deletions

View file

@ -126,6 +126,17 @@ struct MinimapMode {
u16 scale = 1;
};
// structure for everything getClientInfo returns, for convenience
struct ClientInfo {
ClientState state;
Address addr;
u32 uptime;
u8 ser_vers;
u16 prot_vers;
u8 major, minor, patch;
std::string vers_string, lang_code;
};
class Server : public con::PeerHandler, public MapEventReceiver,
public IGameDef
{
@ -326,9 +337,7 @@ public:
void DenyAccess_Legacy(session_t peer_id, const std::wstring &reason);
void DisconnectPeer(session_t peer_id);
bool getClientConInfo(session_t peer_id, con::rtt_stat_type type, float *retval);
bool getClientInfo(session_t peer_id, ClientState *state, u32 *uptime,
u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
std::string* vers_string, std::string* lang_code);
bool getClientInfo(session_t peer_id, ClientInfo &ret);
void printToConsoleOnly(const std::string &text);