@ChannelHandler.Sharable public class LoginHandler extends io.netty.channel.SimpleChannelInboundHandler<Event>
| 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 |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
Event event) |
private void |
closeChannelWithLoginFailure(io.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,
io.netty.channel.ChannelFuture future) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
UniqueIDGeneratorService |
getIdGeneratorService() |
LookupService |
getLookupService() |
ReconnectSessionRegistry |
getReconnectRegistry() |
SessionRegistryService<SocketAddress> |
getUdpSessionRegistry() |
void |
handleGameRoomJoin(Player player,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer) |
void |
handleLogin(Player player,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer) |
protected void |
handleReconnect(PlayerSession playerSession,
io.netty.channel.ChannelHandlerContext ctx,
io.netty.buffer.ByteBuf buffer) |
protected void |
handleReJoin(PlayerSession playerSession,
GameRoom gameRoom,
io.netty.channel.Channel channel,
io.netty.buffer.ByteBuf buffer) |
protected void |
loginUdp(PlayerSession playerSession,
io.netty.buffer.ByteBuf buffer)
This method adds the player session to the
SessionRegistryService. |
Player |
lookupPlayer(io.netty.buffer.ByteBuf buffer,
io.netty.channel.Channel channel) |
PlayerSession |
lookupSession(String reconnectKey) |
void |
setIdGeneratorService(UniqueIDGeneratorService idGeneratorService) |
void |
setLookupService(LookupService lookupService) |
void |
setReconnectRegistry(ReconnectSessionRegistry reconnectRegistry) |
void |
setUdpSessionRegistry(SessionRegistryService<SocketAddress> udpSessionRegistry) |
acceptInboundMessage, channelReadchannelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredprivate 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 channelRead0(io.netty.channel.ChannelHandlerContext ctx,
Event event)
throws Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in class io.netty.channel.ChannelHandlerAdapterExceptionpublic void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic Player lookupPlayer(io.netty.buffer.ByteBuf buffer, io.netty.channel.Channel channel)
public PlayerSession lookupSession(String reconnectKey)
public void handleLogin(Player player, io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer)
protected void handleReconnect(PlayerSession playerSession, io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer)
private void closeChannelWithLoginFailure(io.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, io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer)
protected void handleReJoin(PlayerSession playerSession, GameRoom gameRoom, io.netty.channel.Channel channel, io.netty.buffer.ByteBuf buffer)
public void connectToGameRoom(GameRoom gameRoom, PlayerSession playerSession, io.netty.channel.ChannelFuture future)
protected void loginUdp(PlayerSession playerSession, io.netty.buffer.ByteBuf 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.