Merge pull request #12658 from ZehMatt/fix-network-hang

Fix freezes on incomplete packet transmission
This commit is contained in:
ζeh Matt 2020-08-12 19:00:27 +02:00 committed by GitHub
commit c1076658fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -1721,8 +1721,10 @@ bool NetworkBase::ProcessConnection(NetworkConnection& connection)
// could not read anything from socket
break;
}
} while (packetStatus == NETWORK_READPACKET_MORE_DATA || packetStatus == NETWORK_READPACKET_SUCCESS);
} while (packetStatus == NETWORK_READPACKET_SUCCESS);
connection.SendQueuedPackets();
if (!connection.ReceivedPacketRecently())
{
if (!connection.GetLastDisconnectReason())
@ -1731,6 +1733,7 @@ bool NetworkBase::ProcessConnection(NetworkConnection& connection)
}
return false;
}
return true;
}

View File

@ -18,7 +18,7 @@
# include "network.h"
constexpr size_t NETWORK_DISCONNECT_REASON_BUFFER_SIZE = 256;
constexpr size_t NetworkBufferSize = 1024;
constexpr size_t NetworkBufferSize = 1024 * 64; // 64 KiB, maximum packet size.
NetworkConnection::NetworkConnection()
{