Make sure sendPacket ByteBuffer has no remaining bytes.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -185,28 +186,34 @@ public class GameClient extends NetClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep the order of packets if sent by multiple threads.
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
try
|
final SocketChannel channel = getChannel();
|
||||||
|
if ((channel != null) && channel.isConnected())
|
||||||
{
|
{
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
{
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
final ServerPacket nextPacket = _pendingPackets.poll();
|
|
||||||
final ByteBuffer byteBuffer = nextPacket.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
nextPacket.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -177,40 +178,35 @@ public class GameClient extends NetClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -194,40 +195,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -194,40 +195,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -201,40 +202,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network;
|
package org.l2jmobius.gameserver.network;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.channels.SocketChannel;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -219,40 +220,35 @@ public class GameClient extends NetClient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.PACKET_ENCRYPTION)
|
// Keep the order of packets if sent by multiple threads.
|
||||||
{
|
|
||||||
_pendingPackets.add(packet);
|
_pendingPackets.add(packet);
|
||||||
synchronized (_pendingPackets)
|
synchronized (_pendingPackets)
|
||||||
{
|
{
|
||||||
writePacket(_pendingPackets.poll());
|
final SocketChannel channel = getChannel();
|
||||||
}
|
if ((channel != null) && channel.isConnected())
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
writePacket(packet);
|
final ServerPacket sendPacket = _pendingPackets.poll();
|
||||||
}
|
final ByteBuffer byteBuffer = sendPacket.getSendableByteBuffer(_encryption);
|
||||||
}
|
|
||||||
|
|
||||||
private void writePacket(ServerPacket packet)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((getChannel() != null) && getChannel().isConnected())
|
|
||||||
{
|
|
||||||
final ByteBuffer byteBuffer = packet.getSendableByteBuffer(_encryption);
|
|
||||||
if (byteBuffer != null)
|
if (byteBuffer != null)
|
||||||
{
|
{
|
||||||
// Send the packet data.
|
// Send the packet data.
|
||||||
getChannel().write(byteBuffer);
|
try
|
||||||
|
{
|
||||||
// Run packet implementation.
|
// Loop while there are remaining bytes in the buffer.
|
||||||
packet.run(_player);
|
while (byteBuffer.hasRemaining())
|
||||||
}
|
{
|
||||||
|
channel.write(byteBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ignored)
|
catch (Exception ignored)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run packet implementation.
|
||||||
|
sendPacket.run(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(SystemMessageId systemMessageId)
|
public void sendPacket(SystemMessageId systemMessageId)
|
||||||
|
Reference in New Issue
Block a user