Exemplo n.º 1
0
        /// <summary>
        /// Ensure sthe pool contains at least 1 socket
        /// Used to check for connection errors against the current host
        /// </summary>
        /// <returns>True if a socket can be acquired, otherwise false</returns>
        public async Task <bool> TryCreateConnection()
        {
            try
            {
                using (var conn = await _pool.Borrow())
                {
                    return(true);
                }
            }
            catch
            {
                // Log?
            }

            return(false);
        }
Exemplo n.º 2
0
 private async Task <T> Execute <T>(ICommand <T> command)
 {
     using (var conn = await _pool.Borrow())
     {
         try
         {
             return(await conn.Item.Execute(command));
         }
         catch
         {
             conn.IsCorrupted = true;
             throw;
         }
     }
 }