Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarNetPacketSocket.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 18:56:16 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-07-27 18:56:16 +1000
commit0ec199b3af68ff3af8248d64e71a76b242d690d9 (patch)
treeced8c551e1566284a0007283b32a1c7a531f6cc5 /source/game/StarNetPacketSocket.cpp
parenta5788e75857e0347e2e826fb2dfe3ceeaaa5cf80 (diff)
Update StarNetPacketSocket.cpp
Diffstat (limited to 'source/game/StarNetPacketSocket.cpp')
-rw-r--r--source/game/StarNetPacketSocket.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/game/StarNetPacketSocket.cpp b/source/game/StarNetPacketSocket.cpp
index 436726a..890f788 100644
--- a/source/game/StarNetPacketSocket.cpp
+++ b/source/game/StarNetPacketSocket.cpp
@@ -371,14 +371,14 @@ void P2PPacketSocket::sendPackets(List<PacketPtr> packets) {
if (compressionStreamEnabled()) {
DataStreamBuffer outBuffer;
while (it.hasNext()) {
- PacketPtr& packet = it.next();
- auto packetType = packet->type();
+ PacketType currentType = it.peekNext()->type();
DataStreamBuffer packetBuffer;
- packet->write(packetBuffer);
- outBuffer.write(packetType);
- outBuffer.writeVlqI((int)packetBuffer.size());
+ while (it.hasNext() && it.peekNext()->type() == currentType)
+ it.next()->write(packetBuffer);
+ outBuffer.write(currentType);
+ outBuffer.write<bool>(false);
outBuffer.writeData(packetBuffer.ptr(), packetBuffer.size());
- m_outgoingStats.mix(packetType, packetBuffer.size(), false);
+ m_outgoingStats.mix(currentType, packetBuffer.size(), false);
}
m_outputMessages.append(m_compressionStream.compress(outBuffer.data()));
} else {