From 4ab90ca2dfff6fcf8c68df5ea0ce096686b4b4ef Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 2 Dec 2022 06:05:40 +0000 Subject: [PATCH] Addition of GameClient pending packet queue. --- .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 32 ++++++++++++------- .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ .../gameserver/network/GameClient.java | 19 +++++++++++ 31 files changed, 590 insertions(+), 12 deletions(-) diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/GameClient.java index cf9707c13c..688339c63d 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/GameClient.java @@ -22,6 +22,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Future; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.locks.ReentrantLock; @@ -68,6 +70,7 @@ public class GameClient extends NetClient (byte) 0x87 // The last 4 bytes are fixed. }; + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -183,23 +186,28 @@ public class GameClient extends NetClient return; } - try + _pendingPackets.add(packet); + synchronized (_pendingPackets) { - if ((getChannel() != null) && getChannel().isConnected()) + try { - final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption); - if (byteBuffer != null) + if ((getChannel() != null) && getChannel().isConnected()) { - // Send the packet data. - getChannel().write(byteBuffer); - - // Run packet implementation. - packet.run(_player); + final ServerPacket nextPacket = _pendingPackets.poll(); + final ByteBuffer byteBuffer = nextPacket.getSendableByteBuffer(_encryption); + if (byteBuffer != null) + { + // Send the packet data. + getChannel().write(byteBuffer); + + // Run packet implementation. + nextPacket.run(_player); + } } } - } - catch (Exception ignored) - { + catch (Exception ignored) + { + } } } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java index b476a6e702..c1bd462711 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java @@ -22,6 +22,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Future; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.locks.ReentrantLock; @@ -56,6 +58,7 @@ public class GameClient extends NetClient protected static final Logger LOGGER = Logger.getLogger(GameClient.class.getName()); protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -175,6 +178,22 @@ public class GameClient extends NetClient return; } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java index 95f69a1c04..60a11a8b99 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -54,6 +56,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -191,6 +194,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/GameClient.java index 95f69a1c04..60a11a8b99 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -54,6 +56,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -191,6 +194,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/GameClient.java index cf5ee1d943..fff81b5d35 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -56,6 +58,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -198,6 +201,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java index 6aa00d82d4..0511f7df6b 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected()) diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/GameClient.java index 3e784341f8..c94108a4d2 100644 --- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/gameserver/network/GameClient.java @@ -21,6 +21,8 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -65,6 +67,7 @@ public class GameClient extends NetClient { protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting"); + private final Queue _pendingPackets = new ConcurrentLinkedQueue<>(); private final FloodProtectors _floodProtectors = new FloodProtectors(this); private final ReentrantLock _playerLock = new ReentrantLock(); private ConnectionState _connectionState = ConnectionState.CONNECTED; @@ -216,6 +219,22 @@ public class GameClient extends NetClient } } + if (Config.PACKET_ENCRYPTION) + { + _pendingPackets.add(packet); + synchronized (_pendingPackets) + { + writePacket(_pendingPackets.poll()); + } + } + else + { + writePacket(packet); + } + } + + private void writePacket(ServerPacket packet) + { try { if ((getChannel() != null) && getChannel().isConnected())