コード例 #1
0
ファイル: HostStorage.cs プロジェクト: Cliveburr/BlueDB
 public static void Release(HostPool pool)
 {
     lock (_poolsLock)
     {
         _pools.Add(pool);
     }
 }
コード例 #2
0
ファイル: HostStorage.cs プロジェクト: Cliveburr/BlueDB
        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);
            }
        }
コード例 #3
0
ファイル: ClientConnection.cs プロジェクト: Cliveburr/BlueDB
        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;
        }
コード例 #4
0
ファイル: ClientConnection.cs プロジェクト: Cliveburr/BlueDB
 public ClientConnection(IPEndPoint endPoint)
 {
     _host     = HostStorage.GetHost(endPoint);
     _idsIndex = 0;
 }