Exemple #1
0
 public static void Release(HostPool pool)
 {
     lock (_poolsLock)
     {
         _pools.Add(pool);
     }
 }
Exemple #2
0
        public static HostPool GetHost(IPEndPoint endPoint)
        {
            lock (_poolsLock)
            {
                var pool = _pools
                           .FirstOrDefault(p => p.EndPoint == endPoint);

                if (pool == null)
                {
                    pool = new HostPool(endPoint);
                }
                else
                {
                    _pools.Remove(pool);
                }

                return(pool);
            }
        }
Exemple #3
0
        public void Dispose()
        {
            var request = new MessageRequest
            {
                Commands = new ICommand[]
                {
                    new ReleaseConnectionCommand()
                }
            };

            var response = SendMessage(request).Result;

            if (!string.IsNullOrEmpty(response.Error))
            {
                //TODO: tratar erro ao soltar a connection
            }

            _host.Release();
            _host = null;
        }
Exemple #4
0
 public ClientConnection(IPEndPoint endPoint)
 {
     _host     = HostStorage.GetHost(endPoint);
     _idsIndex = 0;
 }