Fix debug build and clean up
This commit is contained in:
parent
1a975f9ef4
commit
056e596d5a
@ -716,12 +716,15 @@ void STKHost::mainLoop()
|
|||||||
|
|
||||||
while (m_exit_timeout.load() > StkTime::getRealTime())
|
while (m_exit_timeout.load() > StkTime::getRealTime())
|
||||||
{
|
{
|
||||||
auto server_peer = getServerPeerForClient();
|
if (!is_server)
|
||||||
if (!is_server && server_peer &&
|
|
||||||
StkTime::getRealTime() - server_peer->getConnectedTime() > 3.0)
|
|
||||||
{
|
{
|
||||||
// Back to default ping interval for client
|
auto server_peer = getServerPeerForClient();
|
||||||
server_peer->setPingInterval(0);
|
if (server_peer &&
|
||||||
|
StkTime::getRealTime() - server_peer->getConnectedTime() > 3.0)
|
||||||
|
{
|
||||||
|
// Back to default ping interval for client
|
||||||
|
server_peer->setPingInterval(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sl = LobbyProtocol::get<ServerLobby>();
|
auto sl = LobbyProtocol::get<ServerLobby>();
|
||||||
@ -793,12 +796,6 @@ void STKHost::mainLoop()
|
|||||||
{
|
{
|
||||||
auto stk_peer = std::make_shared<STKPeer>
|
auto stk_peer = std::make_shared<STKPeer>
|
||||||
(event.peer, this, m_next_unique_host_id++);
|
(event.peer, this, m_next_unique_host_id++);
|
||||||
if (!is_server)
|
|
||||||
{
|
|
||||||
// This allow client to get the correct ping as fast as
|
|
||||||
// possible
|
|
||||||
stk_peer->setPingInterval(10);
|
|
||||||
}
|
|
||||||
std::unique_lock<std::mutex> lock(m_peers_mutex);
|
std::unique_lock<std::mutex> lock(m_peers_mutex);
|
||||||
m_peers[event.peer] = stk_peer;
|
m_peers[event.peer] = stk_peer;
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "network/stk_peer.hpp"
|
#include "network/stk_peer.hpp"
|
||||||
#include "config/user_config.hpp"
|
#include "config/user_config.hpp"
|
||||||
#include "network/game_setup.hpp"
|
#include "network/network_config.hpp"
|
||||||
#include "network/network_string.hpp"
|
#include "network/network_string.hpp"
|
||||||
#include "network/network_player_profile.hpp"
|
#include "network/network_player_profile.hpp"
|
||||||
#include "network/stk_host.hpp"
|
#include "network/stk_host.hpp"
|
||||||
@ -37,7 +37,12 @@ STKPeer::STKPeer(ENetPeer *enet_peer, STKHost* host, uint32_t host_id)
|
|||||||
m_host_id = host_id;
|
m_host_id = host_id;
|
||||||
m_connected_time = (float)StkTime::getRealTime();
|
m_connected_time = (float)StkTime::getRealTime();
|
||||||
m_token_set.store(false);
|
m_token_set.store(false);
|
||||||
setPingInterval(10);
|
if (NetworkConfig::get()->isClient())
|
||||||
|
{
|
||||||
|
// This allow client to get the correct ping as fast as possible
|
||||||
|
// reset to default (0) will be done in STKHost::mainloop after 3 sec
|
||||||
|
setPingInterval(10);
|
||||||
|
}
|
||||||
m_client_server_token.store(0);
|
m_client_server_token.store(0);
|
||||||
} // STKPeer
|
} // STKPeer
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user