@ChannelHandler.Sharable
public class LoginHandler
extends org.jboss.netty.channel.SimpleChannelUpstreamHandler
Modifier and Type | Field and Description |
---|---|
private static AtomicInteger |
CHANNEL_COUNTER
Used for book keeping purpose.
|
protected UniqueIDGeneratorService |
idGeneratorService |
private static org.slf4j.Logger |
LOG |
protected LookupService |
lookupService |
protected ReconnectSessionRegistry |
reconnectRegistry |
protected SessionRegistryService<SocketAddress> |
udpSessionRegistry |
Constructor and Description |
---|
LoginHandler() |
Modifier and Type | Method and Description |
---|---|
void |
channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e) |
private void |
closeChannelWithLoginFailure(org.jboss.netty.channel.Channel channel)
Helper method which will close the channel after writing
Events.LOG_IN_FAILURE to remote connection. |
void |
connectToGameRoom(GameRoom gameRoom,
PlayerSession playerSession,
org.jboss.netty.channel.ChannelFuture future) |
UniqueIDGeneratorService |
getIdGeneratorService() |
LookupService |
getLookupService() |
ReconnectSessionRegistry |
getReconnectRegistry() |
SessionRegistryService<SocketAddress> |
getUdpSessionRegistry() |
void |
handleGameRoomJoin(Player player,
org.jboss.netty.channel.Channel channel,
org.jboss.netty.buffer.ChannelBuffer buffer) |
void |
handleLogin(Player player,
org.jboss.netty.channel.Channel channel,
org.jboss.netty.buffer.ChannelBuffer buffer) |
protected void |
handleReconnect(PlayerSession playerSession,
org.jboss.netty.channel.Channel channel,
org.jboss.netty.buffer.ChannelBuffer buffer) |
protected void |
handleReJoin(PlayerSession playerSession,
GameRoom gameRoom,
org.jboss.netty.channel.Channel channel,
org.jboss.netty.buffer.ChannelBuffer buffer) |
protected void |
loginUdp(PlayerSession playerSession,
org.jboss.netty.buffer.ChannelBuffer buffer)
This method adds the player session to the
SessionRegistryService . |
Player |
lookupPlayer(org.jboss.netty.buffer.ChannelBuffer buffer,
org.jboss.netty.channel.Channel channel) |
PlayerSession |
lookupSession(String reconnectKey) |
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e) |
void |
setIdGeneratorService(UniqueIDGeneratorService idGeneratorService) |
void |
setLookupService(LookupService lookupService) |
void |
setReconnectRegistry(ReconnectSessionRegistry reconnectRegistry) |
void |
setUdpSessionRegistry(SessionRegistryService<SocketAddress> udpSessionRegistry) |
private static final org.slf4j.Logger LOG
protected LookupService lookupService
protected SessionRegistryService<SocketAddress> udpSessionRegistry
protected ReconnectSessionRegistry reconnectRegistry
protected UniqueIDGeneratorService idGeneratorService
private static final AtomicInteger CHANNEL_COUNTER
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e) throws Exception
messageReceived
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Exception
public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e) throws Exception
channelOpen
in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Exception
public Player lookupPlayer(org.jboss.netty.buffer.ChannelBuffer buffer, org.jboss.netty.channel.Channel channel)
public PlayerSession lookupSession(String reconnectKey)
public void handleLogin(Player player, org.jboss.netty.channel.Channel channel, org.jboss.netty.buffer.ChannelBuffer buffer)
protected void handleReconnect(PlayerSession playerSession, org.jboss.netty.channel.Channel channel, org.jboss.netty.buffer.ChannelBuffer buffer)
private void closeChannelWithLoginFailure(org.jboss.netty.channel.Channel channel)
Events.LOG_IN_FAILURE
to remote connection.channel
- The tcp connection to remote machine that will be closed.public void handleGameRoomJoin(Player player, org.jboss.netty.channel.Channel channel, org.jboss.netty.buffer.ChannelBuffer buffer)
protected void handleReJoin(PlayerSession playerSession, GameRoom gameRoom, org.jboss.netty.channel.Channel channel, org.jboss.netty.buffer.ChannelBuffer buffer)
public void connectToGameRoom(GameRoom gameRoom, PlayerSession playerSession, org.jboss.netty.channel.ChannelFuture future)
protected void loginUdp(PlayerSession playerSession, org.jboss.netty.buffer.ChannelBuffer buffer)
SessionRegistryService
. The key being the remote udp address of
the client and the session being the value.playerSession
- buffer
- Used to read the remote address of the client which is
attempting to connect via udp.public LookupService getLookupService()
public void setLookupService(LookupService lookupService)
public UniqueIDGeneratorService getIdGeneratorService()
public void setIdGeneratorService(UniqueIDGeneratorService idGeneratorService)
public SessionRegistryService<SocketAddress> getUdpSessionRegistry()
public void setUdpSessionRegistry(SessionRegistryService<SocketAddress> udpSessionRegistry)
public ReconnectSessionRegistry getReconnectRegistry()
public void setReconnectRegistry(ReconnectSessionRegistry reconnectRegistry)
Copyright © 2013. All Rights Reserved.