When client without proxy 'exits', it closes TCP connection to OTS, so OTS is noticed that connection goes offline and delete
Connection/
ProtocolGame in C++, so server shows IP
0.0.0.0 for that player (
forgottenserver/src/player.cpp at 1.4 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/1.4/src/player.cpp#L1975) ).
When client with proxy 'exits', it closes TCP connections to alpha proxy server, but alpha proxy server does not close connection to OTS.
You can detect 'exit' in alpha proxy by replacing these lines (
alpha-proxy/server.cpp at main · thatmichaelguy/alpha-proxy (https://github.com/thatmichaelguy/alpha-proxy/blob/main/server.cpp#L202-L221) ) with:
C++:
void Session::removeProxy(const ProxyPtr &proxy)
{
#ifdef DEBUG
std::clog << "[Session " << m_id << "] removeProxy" << std::endl;
#endif
for (auto it = m_proxies.begin(); it != m_proxies.end();)
{
if (auto p = it->lock())
{
if (p == proxy)
{
it = m_proxies.erase(it);
continue;
}
++it;
continue;
}
it = m_proxies.erase(it);
}
if (m_proxies.empty()) {
terminate();
}
}
It will close connection to OTS, when number of active sessions with client (client tries to keep 2 active) go to 0. I think that no one noticed that problem before, because no one used IP
0.0.0.0 as detection of connection lose. It only detects 'exit', not real problems with internet.
With and without proxy, if player really lose internet (ex. turn off WiFi on PC, block network on firewall by mistake), not 'exit' in client, server won't be 'noticed' that TCP connection does not work and it will take 30 seconds before OTS engine notice that connection is not active, drop it and show IP 0.0.0.0.
If you really want to detect people losing connection, you should modify server to send 'tibia ping' every second and 'protect' players that did not send any packet to server for X seconds (they should send at least 1 packet per second - response to ping). I worked for OTS that decided to send ping 10 times per second, to detect lags over 500 ms.