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); }
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); }