Reduce time for NetPlayClient to disconnect or fail to connect by adjusting timeouts on enet_host_service calls
This commit is contained in:
parent
924a4ee0be
commit
a91ccc4fab
|
@ -157,7 +157,7 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
|
||||||
enet_peer_timeout(m_server, 0, PEER_TIMEOUT.count(), PEER_TIMEOUT.count());
|
enet_peer_timeout(m_server, 0, PEER_TIMEOUT.count(), PEER_TIMEOUT.count());
|
||||||
|
|
||||||
ENetEvent netEvent;
|
ENetEvent netEvent;
|
||||||
int net = enet_host_service(m_client, &netEvent, 5000);
|
int net = enet_host_service(m_client, &netEvent, 1000);
|
||||||
if (net > 0 && netEvent.type == ENET_EVENT_TYPE_CONNECT)
|
if (net > 0 && netEvent.type == ENET_EVENT_TYPE_CONNECT)
|
||||||
{
|
{
|
||||||
if (Connect())
|
if (Connect())
|
||||||
|
@ -1499,7 +1499,7 @@ void NetPlayClient::Disconnect()
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (enet_host_service(m_client, &netEvent, 3000) > 0)
|
while (enet_host_service(m_client, &netEvent, 500) > 0)
|
||||||
{
|
{
|
||||||
switch (netEvent.type)
|
switch (netEvent.type)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue