internal Connection(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, PerfStatsCollector perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName) { _container = container; _commandRecieved = commandRecieved; _serverLost = serverLost; _logger = logs; _responseIntegrator = rspIntegraotr; _cacheId = cacheName; _perfStatsColl = perfStatsCollector; SetBindIP(bindIP); if (System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"] != null) { _nagglingEnabled = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"]); } //read the naggling size from app.config and covert it to bytes. if (System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"] != null) { _nagglingSize = 1024 * Convert.ToInt64(System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"]); } if (System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"] != null) { _supportDualSocket = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"]); } }
private void Initialize(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, PerfStatsCollector perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName) { _commandRecieved = null; _serverLost = null; _isConnected = true; _primaryClient = null; _secondaryClient = null; _ipAddress = string.Empty; _intendedRecipientIPAddress = string.Empty; _port = 0; _connectionMutex = new object(); _connectionStatusLatch = new Latch(ConnectionStatus.Disconnected); s_receiveBufferSize = 2048000; _processID = System.Diagnostics.Process.GetCurrentProcess().Id; _primaryReceiveThread = null; _secondaryReceiveThread = null; _notificationsRegistered = false; _isReconnecting = false; _forcedDisconnect = false; _nagglingEnabled = false; _nagglingSize = 5 * 100 * 1024; //500k _supportDualSocket = false; _syncLock = new object(); _perfStatsColl = null; _socketSelectionMutex = new object(); _usePrimary = true; _optimized = false; _isIdle = false; _container = container; _commandRecieved = commandRecieved; _serverLost = serverLost; _logger = logs; _responseIntegrator = rspIntegraotr; _cacheId = cacheName; _perfStatsColl = perfStatsCollector; SetBindIP(bindIP); if (System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"] != null) { _nagglingEnabled = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableNaggling"]); } //read the naggling size from app.config and covert it to bytes. if (System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"] != null) { _nagglingSize = 1024 * Convert.ToInt64(System.Configuration.ConfigurationSettings.AppSettings["NagglingSize"]); } if (System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"] != null) { _supportDualSocket = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["EnableDualSockets"]); } }
/// <summary> /// it transfers the existing connection to a new connection without changing the object container /// </summary> /// <param name="container"></param> /// <param name="commandRecieved"></param> /// <param name="serverLost"></param> /// <param name="logs"></param> /// <param name="perfStatsCollector"></param> /// <param name="rspIntegraotr"></param> /// <param name="bindIP"></param> /// <param name="cacheName"></param> /// <param name="ipAddress"></param> /// <param name="cachePort"></param> /// <returns></returns> public bool SwitchTo(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, PerfStatsCollector perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName, IPAddress ipAddress, int cachePort) { int oldPort = Port; Initialize(container, commandRecieved, serverLost, logs, perfStatsCollector, rspIntegraotr, bindIP, cacheName); if (this.Connect(Address, cachePort)) { _hostPort = cachePort; this.Port = oldPort; return(true); } return(false); }
internal Connection(Broker container, OnCommandRecieved commandRecieved, OnServerLost serverLost, Logs logs, PerfStatsCollector perfStatsCollector, ResponseIntegrator rspIntegraotr, string bindIP, string cacheName) { Initialize(container, commandRecieved, serverLost, logs, perfStatsCollector, rspIntegraotr, bindIP, cacheName); }