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