Addition of GameClient pending packet queue.
This commit is contained in:
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -22,6 +22,8 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
@ -68,6 +70,7 @@ public class GameClient extends NetClient
|
|||||||
(byte) 0x87 // The last 4 bytes are fixed.
|
(byte) 0x87 // The last 4 bytes are fixed.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
||||||
@ -183,23 +186,28 @@ public class GameClient extends NetClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
_pendingPackets.add(packet);
|
||||||
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
try
|
||||||
{
|
{
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
if (byteBuffer != null)
|
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
final ServerPacket nextPacket = _pendingPackets.poll();
|
||||||
getChannel().write(byteBuffer);
|
final ByteBuffer byteBuffer = nextPacket.getSendableByteBuffer(_encryption);
|
||||||
|
if (byteBuffer != null)
|
||||||
// Run packet implementation.
|
{
|
||||||
packet.run(_player);
|
// Send the packet data.
|
||||||
|
getChannel().write(byteBuffer);
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
nextPacket.run(_player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception ignored)
|
||||||
catch (Exception ignored)
|
{
|
||||||
{
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
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 = Logger.getLogger(GameClient.class.getName());
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
||||||
@ -175,6 +178,22 @@ public class GameClient extends NetClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Config.PACKET_ENCRYPTION)
|
||||||
|
{
|
||||||
|
_pendingPackets.add(packet);
|
||||||
|
synchronized (_pendingPackets)
|
||||||
|
{
|
||||||
|
writePacket(_pendingPackets.poll());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writePacket(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writePacket(ServerPacket packet)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -54,6 +56,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -54,6 +56,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -56,6 +58,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
@ -21,6 +21,8 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Queue;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -65,6 +67,7 @@ public class GameClient extends NetClient
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
protected static final Logger LOGGER_ACCOUNTING = Logger.getLogger("accounting");
|
||||||
|
|
||||||
|
private final Queue<ServerPacket> _pendingPackets = new ConcurrentLinkedQueue<>();
|
||||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||||
private ConnectionState _connectionState = ConnectionState.CONNECTED;
|
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
|
try
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
if ((getChannel() != null) && getChannel().isConnected())
|
||||||
|
Reference in New Issue
Block a user