Example #1
0
        public Connection(IPAddress address, TransportConfig config, ILogger logger)
        {
            Endpoint = address;
            _config = config;
            _logger = logger;
            _tcpClient = new TcpClient();
            _tcpClient.Connect(address, _config.Port);

            Stream stream = _tcpClient.GetStream();
            #if DEBUG_STREAM
            stream = new DebugStream(stream);
            #endif

            _outputStream = stream;
            _inputStream = stream;

            for (byte idx = 0; idx < STREAMID_MAX; ++idx)
            {
                _availableStreamIds.Push(idx);
                _requestStates[idx].Lock = new object();
            }

            _logger.Debug("Ready'ing connection for {0}", Endpoint);
            GetOptions();
            ReadifyConnection();
            _logger.Debug("Connection to {0} is ready", Endpoint);
        }
Example #2
0
        public Connection(IPAddress address, TransportConfig config, ILogger logger, IInstrumentation instrumentation)
        {
            Endpoint = address;
            _config = config;
            _logger = logger;
            _instrumentation = instrumentation;
            _tcpClient = new TcpClient();
            _tcpClient.Connect(address, _config.Port);
            _streaming = config.Streaming;

            for (byte idx = 0; idx < MAX_STREAMID; ++idx)
            {
                _availableStreamIds.Push(idx);
            }

            _socket = _tcpClient.Client;

            // start a new read task
            Task.Factory.StartNew(ReadNextFrameHeader, _cancellation.Token);

            // readify the connection
            _logger.Debug("Readyfying connection for {0}", Endpoint);
            //GetOptions();
            ReadifyConnection();
            _logger.Debug("Connection to {0} is ready", Endpoint);
        }
Example #3
0
        public Connection(IPAddress address, TransportConfig config, ILogger logger)
        {
            Endpoint = address;
            _config = config;
            _logger = logger;
            _tcpClient = new TcpClient();
            _tcpClient.Connect(address, _config.Port);
            _streaming = config.Streaming;

            Stream stream = _tcpClient.GetStream();
            #if DEBUG_STREAM
            stream = new DebugStream(stream);
            #endif

            _outputStream = stream;
            _inputStream = stream;

            for (byte idx = 0; idx < MAX_STREAMID; ++idx)
            {
                _availableStreamIds.Push(idx);
            }

            // start a new read task
            Task.Factory.StartNew(ReadNextFrameHeader, _cancellation.Token);

            // readify the connection
            _logger.Debug("Readyfying connection for {0}", Endpoint);
            GetOptions();
            ReadifyConnection();
            _logger.Debug("Connection to {0} is ready", Endpoint);
        }
 public LongRunningConnectionFactory(TransportConfig config, KeyspaceConfig keyspaceConfig, ILogger logger, IInstrumentation instrumentation)
 {
     _config = config;
     _keyspaceConfig = keyspaceConfig;
     _logger = logger;
     _instrumentation = instrumentation;
 }
 public ConnectionFactory(TransportConfig config, ILogger logger, IInstrumentation instrumentation)
 {
     _config = config;
     _logger = logger;
     _instrumentation = instrumentation;
 }
 public ConnectionFactory(TransportConfig config, ILogger logger)
 {
     _config = config;
     _logger = logger;
 }