mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-26 22:45:15 -04:00
[Browser] Fix continuous loop when connection was failed
This commit is contained in:
parent
4a5b8c927f
commit
1956045e99
@ -68,8 +68,8 @@ ServerExtendedData getExtendedData(const char *addr, unsigned short port)
|
|||||||
msg = "Connection attempt failed.\n";
|
msg = "Connection attempt failed.\n";
|
||||||
|
|
||||||
|
|
||||||
bool queue = true;
|
int queue = 0;
|
||||||
while (queue)
|
while (queue == 0)
|
||||||
{
|
{
|
||||||
for (RakNet::Packet *packet = peer->Receive(); packet; peer->DeallocatePacket(
|
for (RakNet::Packet *packet = peer->Receive(); packet; peer->DeallocatePacket(
|
||||||
packet), packet = peer->Receive())
|
packet), packet = peer->Receive())
|
||||||
@ -81,20 +81,20 @@ ServerExtendedData getExtendedData(const char *addr, unsigned short port)
|
|||||||
msg = "Connection failed.\n"
|
msg = "Connection failed.\n"
|
||||||
"Either the IP address is wrong or a firewall on either system is blocking\n"
|
"Either the IP address is wrong or a firewall on either system is blocking\n"
|
||||||
"UDP packets on the port you have chosen.";
|
"UDP packets on the port you have chosen.";
|
||||||
queue = false;
|
queue = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_INVALID_PASSWORD:
|
case ID_INVALID_PASSWORD:
|
||||||
{
|
{
|
||||||
msg = "Connection failed.\n"
|
msg = "Connection failed.\n"
|
||||||
"The client or server is outdated.\n";
|
"The client or server is outdated.\n";
|
||||||
queue = false;
|
queue = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_CONNECTION_REQUEST_ACCEPTED:
|
case ID_CONNECTION_REQUEST_ACCEPTED:
|
||||||
{
|
{
|
||||||
msg = "Connection accepted.\n";
|
msg = "Connection accepted.\n";
|
||||||
queue = false;
|
queue = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ID_DISCONNECTION_NOTIFICATION:
|
case ID_DISCONNECTION_NOTIFICATION:
|
||||||
@ -110,6 +110,9 @@ ServerExtendedData getExtendedData(const char *addr, unsigned short port)
|
|||||||
}
|
}
|
||||||
puts(msg.c_str());
|
puts(msg.c_str());
|
||||||
|
|
||||||
|
if(queue == -1) // connection is failed
|
||||||
|
return data;
|
||||||
|
|
||||||
{
|
{
|
||||||
RakNet::BitStream bs;
|
RakNet::BitStream bs;
|
||||||
bs.Write((unsigned char) (ID_USER_PACKET_ENUM + 1));
|
bs.Write((unsigned char) (ID_USER_PACKET_ENUM + 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user