mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-17 01:04:34 +00:00
feat(Core/Compression): Move packets compression from map to network thread (#18602)
* feat(Code/Compression): Move packets compression from map to network thread. * Code style fix * Remove unicode letter
This commit is contained in:
committed by
GitHub
parent
3ff8de2086
commit
73340b94e3
@@ -30,17 +30,21 @@
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
|
||||
class EncryptablePacket : public WorldPacket
|
||||
class EncryptableAndCompressiblePacket : public WorldPacket
|
||||
{
|
||||
public:
|
||||
EncryptablePacket(WorldPacket const& packet, bool encrypt) : WorldPacket(packet), _encrypt(encrypt)
|
||||
EncryptableAndCompressiblePacket(WorldPacket const& packet, bool encrypt) : WorldPacket(packet), _encrypt(encrypt)
|
||||
{
|
||||
SocketQueueLink.store(nullptr, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
bool NeedsEncryption() const { return _encrypt; }
|
||||
|
||||
std::atomic<EncryptablePacket*> SocketQueueLink;
|
||||
bool NeedsCompression() const { return GetOpcode() == SMSG_UPDATE_OBJECT && size() > 100; }
|
||||
|
||||
void CompressIfNeeded();
|
||||
|
||||
std::atomic<EncryptableAndCompressiblePacket*> SocketQueueLink;
|
||||
|
||||
private:
|
||||
bool _encrypt;
|
||||
@@ -125,7 +129,7 @@ private:
|
||||
|
||||
MessageBuffer _headerBuffer;
|
||||
MessageBuffer _packetBuffer;
|
||||
MPSCQueue<EncryptablePacket, &EncryptablePacket::SocketQueueLink> _bufferQueue;
|
||||
MPSCQueue<EncryptableAndCompressiblePacket, &EncryptableAndCompressiblePacket::SocketQueueLink> _bufferQueue;
|
||||
std::size_t _sendBufferSize;
|
||||
|
||||
QueryCallbackProcessor _queryProcessor;
|
||||
|
||||
Reference in New Issue
Block a user