public abstract class AbstractServerHandler<T>
extends io.netty.channel.SimpleChannelInboundHandler<T>
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
encrypt
网络加密,默认不加密
|
protected xyz.noark.core.network.NetworkListener |
networkListener
监听器扩展方案
|
protected byte[] |
secretKey
网络加密之密钥:默认配置为无边落木萧萧下,不尽长江滚滚来
|
| 构造器和说明 |
|---|
AbstractServerHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
channelActive(io.netty.channel.Channel channel)
处理链接通道激活逻辑
|
protected abstract xyz.noark.core.network.Session |
createSession(io.netty.channel.Channel channel)
创建Session.
|
protected void |
dispatchPacket(io.netty.channel.ChannelHandlerContext ctx,
xyz.noark.core.network.NetworkPacket packet)
处理好网络封包后派发逻辑.
|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Throwable cause) |
acceptInboundMessage, channelRead, channelRead0channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharable@Autowired(required=false) protected xyz.noark.core.network.NetworkListener networkListener
@Value(value="network.encrypt") protected boolean encrypt
@Value(value="network.secretkey") protected byte[] secretKey
public void channelActive(io.netty.channel.Channel channel)
channel - 链接通道protected abstract xyz.noark.core.network.Session createSession(io.netty.channel.Channel channel)
channel - 链接protected void dispatchPacket(io.netty.channel.ChannelHandlerContext ctx,
xyz.noark.core.network.NetworkPacket packet)
ctx - 链接上下文packet - 网络封包public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
java.lang.Throwable cause)
throws java.lang.Exception
exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterjava.lang.Exception