Changed the way a Client session is active and moved to event and states of Channel for CONNECT and DISCONNET messages

This commit is contained in:
andsel
2016-11-05 18:29:08 +01:00
parent 8e43f75f70
commit 7508275cf7
6 changed files with 107 additions and 37 deletions
@@ -120,4 +120,15 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
}
ctx.fireChannelWritabilityChanged();
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof ProtocolProcessor.ForceDisconnectEvent) {
ProtocolProcessor.ForceDisconnectEvent disconnectEvent = (ProtocolProcessor.ForceDisconnectEvent) evt;
m_processor.forceCloseConnection(ctx.channel(), disconnectEvent.newChannel, disconnectEvent.msg);
} else if (evt instanceof ProtocolProcessor.CompleteConnect) {
ProtocolProcessor.CompleteConnect completeConnectEvent = (ProtocolProcessor.CompleteConnect) evt;
m_processor.completeConnect(ctx.channel(), completeConnectEvent.msg);
}
}
}