コード例 #1
0
        public override void ChannelInactive(IChannelHandlerContext context)
        {
            var session = context.Channel.GetAttribute(ChannelAttributes.Session).Get();

            session.Dispose();
            _server.RemoveSession(session);
            _server.Configuration.HostIdFactory.Free(session.HostId);
            base.ChannelInactive(context);
        }
コード例 #2
0
        public override void ChannelInactive(IChannelHandlerContext context)
        {
            var session = context.Channel.GetAttribute(ChannelAttributes.Session).Get();

            _server.Configuration.Logger?
            .ForContext("HostId", session.HostId)
            .ForContext("EndPoint", context.Channel.RemoteAddress.ToString())
            .Debug("Client({HostId}) disconnected");

            session.Dispose();
            _server.RemoveSession(session);
            _server.Configuration.HostIdFactory.Free(session.HostId);
            base.ChannelInactive(context);
        }