aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-06-08 00:08:37 +0200
committerShauren <shauren.trinity@gmail.com>2020-06-08 00:08:37 +0200
commit5fce3604fc9613299f8780d30abbbe69c0c7e531 (patch)
tree531af1ed3b22c3a5041918043a775cc55cd49708 /src/server/game/Server
parente5a6552abcbf0f179aebb67751527242968522f7 (diff)
Core/PacketIO: Fixed receiving and sending db2 hotfix packets
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/HotfixPackets.cpp63
-rw-r--r--src/server/game/Server/Packets/HotfixPackets.h11
-rw-r--r--src/server/game/Server/WorldSession.cpp5
-rw-r--r--src/server/game/Server/WorldSocket.h2
4 files changed, 39 insertions, 42 deletions
diff --git a/src/server/game/Server/Packets/HotfixPackets.cpp b/src/server/game/Server/Packets/HotfixPackets.cpp
index 79565cd7fa3..4f77cff5721 100644
--- a/src/server/game/Server/Packets/HotfixPackets.cpp
+++ b/src/server/game/Server/Packets/HotfixPackets.cpp
@@ -18,7 +18,27 @@
#include "HotfixPackets.h"
#include "PacketUtilities.h"
-void WorldPackets::Hotfix::DBQueryBulk::Read()
+namespace WorldPackets
+{
+namespace Hotfix
+{
+ByteBuffer& operator>>(ByteBuffer& data, DB2Manager::HotfixRecord& hotfixRecord)
+{
+ data >> hotfixRecord.TableHash;
+ data >> hotfixRecord.RecordID;
+ data >> hotfixRecord.HotfixID;
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, DB2Manager::HotfixRecord const& hotfixRecord)
+{
+ data << uint32(hotfixRecord.TableHash);
+ data << int32(hotfixRecord.RecordID);
+ data << int32(hotfixRecord.HotfixID);
+ return data;
+}
+
+void DBQueryBulk::Read()
{
_worldPacket >> TableHash;
@@ -29,7 +49,7 @@ void WorldPackets::Hotfix::DBQueryBulk::Read()
_worldPacket >> Queries[i].RecordID;
}
-WorldPacket const* WorldPackets::Hotfix::DBReply::Write()
+WorldPacket const* DBReply::Write()
{
_worldPacket << uint32(TableHash);
_worldPacket << uint32(RecordID);
@@ -41,40 +61,17 @@ WorldPacket const* WorldPackets::Hotfix::DBReply::Write()
return &_worldPacket;
}
-WorldPacket const* WorldPackets::Hotfix::AvailableHotfixes::Write()
+WorldPacket const* AvailableHotfixes::Write()
{
_worldPacket << int32(HotfixCacheVersion);
_worldPacket << uint32(HotfixCount);
- for (auto const& hotfixEntry : Hotfixes)
- {
- for (auto const& tableRecord : hotfixEntry.second)
- {
- _worldPacket << uint32(tableRecord.first);
- _worldPacket << int32(tableRecord.second);
- _worldPacket << int32(hotfixEntry.first);
- }
- }
+ for (DB2Manager::HotfixRecord const& hotfixRecord : Hotfixes)
+ _worldPacket << hotfixRecord;
return &_worldPacket;
}
-ByteBuffer& operator>>(ByteBuffer& data, WorldPackets::Hotfix::HotfixRecord& hotfixRecord)
-{
- data >> hotfixRecord.TableHash;
- data >> hotfixRecord.RecordID;
- data >> hotfixRecord.HotfixID;
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Hotfix::HotfixRecord const& hotfixRecord)
-{
- data << uint32(hotfixRecord.TableHash);
- data << int32(hotfixRecord.RecordID);
- data << int32(hotfixRecord.HotfixID);
- return data;
-}
-
-void WorldPackets::Hotfix::HotfixRequest::Read()
+void HotfixRequest::Read()
{
_worldPacket >> ClientBuild;
_worldPacket >> DataBuild;
@@ -84,11 +81,11 @@ void WorldPackets::Hotfix::HotfixRequest::Read()
throw PacketArrayMaxCapacityException(hotfixCount, sDB2Manager.GetHotfixCount());
Hotfixes.resize(hotfixCount);
- for (HotfixRecord& hotfixRecord : Hotfixes)
+ for (DB2Manager::HotfixRecord& hotfixRecord : Hotfixes)
_worldPacket >> hotfixRecord;
}
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Hotfix::HotfixResponse::HotfixData const& hotfixData)
+ByteBuffer& operator<<(ByteBuffer& data, HotfixResponse::HotfixData const& hotfixData)
{
data << hotfixData.Record;
if (hotfixData.Size)
@@ -106,7 +103,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Hotfix::HotfixResponse::H
return data;
}
-WorldPacket const* WorldPackets::Hotfix::HotfixResponse::Write()
+WorldPacket const* HotfixResponse::Write()
{
_worldPacket << uint32(Hotfixes.size());
for (HotfixData const& hotfix : Hotfixes)
@@ -117,3 +114,5 @@ WorldPacket const* WorldPackets::Hotfix::HotfixResponse::Write()
return &_worldPacket;
}
+}
+}
diff --git a/src/server/game/Server/Packets/HotfixPackets.h b/src/server/game/Server/Packets/HotfixPackets.h
index f83926367f6..497a85d55d9 100644
--- a/src/server/game/Server/Packets/HotfixPackets.h
+++ b/src/server/game/Server/Packets/HotfixPackets.h
@@ -71,13 +71,6 @@ namespace WorldPackets
DB2Manager::HotfixContainer const& Hotfixes;
};
- struct HotfixRecord
- {
- uint32 TableHash = 0;
- int32 RecordID = 0;
- int32 HotfixID = 0;
- };
-
class HotfixRequest final : public ClientPacket
{
public:
@@ -87,7 +80,7 @@ namespace WorldPackets
uint32 ClientBuild = 0;
uint32 DataBuild = 0;
- std::vector<HotfixRecord> Hotfixes;
+ std::vector<DB2Manager::HotfixRecord> Hotfixes;
};
class HotfixResponse final : public ServerPacket
@@ -95,7 +88,7 @@ namespace WorldPackets
public:
struct HotfixData
{
- HotfixRecord Record;
+ DB2Manager::HotfixRecord Record;
Optional<uint32> Size;
};
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 1618267d420..1c9f49df88b 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -1391,6 +1391,11 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
maxPacketCounterAllowed = PLAYER_SLOTS_COUNT;
break;
}
+ case CMSG_HOTFIX_REQUEST: // not profiled
+ {
+ maxPacketCounterAllowed = 1;
+ break;
+ }
default:
{
maxPacketCounterAllowed = 100;
diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h
index 572df283d8a..057c5bd1250 100644
--- a/src/server/game/Server/WorldSocket.h
+++ b/src/server/game/Server/WorldSocket.h
@@ -56,7 +56,7 @@ struct PacketHeader
uint32 Size;
uint8 Tag[12];
- bool IsValidSize() { return Size < 0x10000; }
+ bool IsValidSize() { return Size < 0x40000; }
};
#pragma pack(pop)