Exemplo n.º 1
0
        public ProudSession(uint hostId, IChannel channel, ProudServer server)
        {
            HostId         = hostId;
            Server         = server;
            Channel        = (ISocketChannel)channel;
            HandhsakeEvent = new AsyncManualResetEvent();
            ConnectDate    = DateTimeOffset.Now;
            var remoteEndPoint = (IPEndPoint)Channel.RemoteAddress;

            RemoteEndPoint = new IPEndPoint(remoteEndPoint.Address.MapToIPv4(), remoteEndPoint.Port);

            var localEndPoint = (IPEndPoint)Channel.LocalAddress;

            LocalEndPoint = new IPEndPoint(localEndPoint.Address.MapToIPv4(), localEndPoint.Port);

            Logger = Server.Configuration.Logger?
                     .ForContext("HostId", HostId)
                     .ForContext("EndPoint", remoteEndPoint.ToString());

            HandleLock = new MaxUseLock(4);
        }
Exemplo n.º 2
0
 public void Dispose()
 {
     _lock.ReleaseNext();
     _lock = null;
 }
Exemplo n.º 3
0
 public DisposableObject(MaxUseLock @lock)
 {
     _lock = @lock;
 }