1package com.runehive.net.session;
3import com.runehive.Config;
4import com.runehive.game.world.World;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.net.packet.GamePacket;
7import com.runehive.net.packet.PacketRepository;
8import io.netty.channel.Channel;
9import io.netty.channel.ChannelFuture;
10import org.apache.logging.log4j.LogManager;
11import org.apache.logging.log4j.Logger;
12import org.jctools.queues.MessagePassingQueue;
13import org.jctools.queues.MpscArrayQueue;
55 final MessagePassingQueue<GamePacket>
incomingPackets = this.incomingPackets;
64 }
catch (Exception ex) {
65 logger.error(String.format(
"error processing client packet for %s",
player), ex);
77 final Channel
channel = this.channel;
78 final boolean channelActive =
channel.isActive();
80 final MessagePassingQueue<GamePacket>
outgoingPackets = this.outgoingPackets;
89 }
catch (
final Exception ex) {
98 if (channelActive && count > 0) {
The class that contains setting-related constants for the server.
static final int CLIENT_PACKET_THRESHOLD
The amount of client (incoming) packets that can be handled by the server each tick.
static final int SERVER_PACKET_THRESHOLD
The amount of server (outgoing) packets that can be written by the server each tick.
Represents the game world.
static void queueLogout(Player player)
Handles queueing the player logouts.
This class represents a character controlled by a player.
Represents a single game packet.
The repository that stores packets sizes and listeners for how to execute the packets.
static void sendToListener(Player player, GamePacket packet)
void handleClientPacket(Object o)
The method that is called when the client sends packets to the server.
final MessagePassingQueue< GamePacket > incomingPackets
GameSession(Channel channel, Player player)
void queueClientPacket(final GamePacket packet)
void queueServerPacket(GamePacket packet)
final MessagePassingQueue< GamePacket > outgoingPackets
static final Logger logger
void processClientPackets()
void processServerPacketQueue()
void onClose(ChannelFuture f)
The method called after a session has been closed.
final Channel channel
The channel attached to this session.
Session(Channel channel)
Creates a new Session.