protected bool Equals(TSocketSettings other)
		{
			return SendBufferSize == other.SendBufferSize 
				&& ReceiveBufferSize == other.ReceiveBufferSize 
				&& SendTimeout == other.SendTimeout 
				&& ReceiveTimeout == other.ReceiveTimeout 
				&& ConnectTimeout == other.ConnectTimeout;
		}
Example #2
0
 protected bool Equals(TSocketSettings other)
 {
     return(SendBufferSize == other.SendBufferSize &&
            ReceiveBufferSize == other.ReceiveBufferSize &&
            SendTimeout == other.SendTimeout &&
            ReceiveTimeout == other.ReceiveTimeout &&
            ConnectTimeout == other.ConnectTimeout);
 }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="indexCatalog"></param>
 /// <param name="host"></param>
 /// <param name="port"></param>
 /// <param name="timeout">Milliseconds</param>
 public ConnectionBuilder(TSocketSettings socketSettings, string host, int port = 9200, bool isframed = false,
                          int timeout = 0, bool pooled = false, int poolSize = 25, int lifetime = 0)
 {
     Servers = new List <Server> {
         new Server(host, port, isframed)
     };
     Timeout          = timeout;
     Pooled           = pooled;
     PoolSize         = poolSize;
     Lifetime         = lifetime;
     ConnectionString = GetConnectionString();
     TSocketSetting   = socketSettings;
 }
Example #4
0
        public ConnectionPool(string host, int port, ConnectionPoolConfig config, bool isframed = false)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            _target         = new Server(host, port, isframed);
            _config         = config;
            _socketSettings = config.SocketSettings ?? TSocketSettings.DefaultSettings;

            if (config.PoolSize > 0)
            {
                _useLimiter        = true;
                _connectionLimiter = new Semaphore(config.PoolSize, config.PoolSize);
            }
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        public Connection(Server server, TSocketSettings socketSettings)
        {
            Created = DateTime.Now;
            Server  = server;
            if (server.IsFramed)
            {
                var tsocket = new TSocket(server.Host, server.Port);
                _transport = new TFramedTransport(tsocket);
//				_transport = new TFramedTransport(server.Host, server.Port, socketSettings);
            }
            else
            {
                var tsocket = new TSocket(server.Host, server.Port);
                _transport = new TBufferedTransport(tsocket, 1024);                 //TODO remove hardcode
            }

            _protocol = new TBinaryProtocol(_transport);
            _client   = new Rest.Client(_protocol);
        }