private void Initialize(IPEndPoint endpoint, ILog log, IStats stats, IZkRepository zkRepository) { base.Log = log; base.Stats = stats; base.ZkRepository = zkRepository ?? new ZkNullRepository(); _endPoint = endpoint; _listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true); _listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontLinger, true); }
public ZkSession(IZkRepository respository) { _repository = respository; }
/// <summary> /// Constructs an instance of the host and starts listening for incoming connections on designated endpoint. /// All listener threads are regular background threads. /// /// NOTE: the instance created from the specified type is not automatically thread safe! /// </summary> /// <param name="endpoint"></param> /// <param name="log"></param> /// <param name="stats"></param> /// <param name="zkRepository">Only required to support zero knowledge authentication and encryption.</param> public TcpHost(IPEndPoint endpoint, ILog log = null, IStats stats = null, IZkRepository zkRepository = null) { Initialize(endpoint, log, stats, zkRepository); }
/// <summary> /// Constructs an instance of the host and starts listening for incoming connections on any ip address. /// All listener threads are regular background threads. /// </summary> /// <param name="port">The port number for incoming requests</param> /// <param name="log"></param> /// <param name="stats"></param> /// <param name="zkRepository">Only required to support zero knowledge authentication and encryption.</param> public TcpHost(int port, ILog log = null, IStats stats = null, IZkRepository zkRepository = null) { Initialize(new IPEndPoint(IPAddress.Any, port), log, stats, zkRepository); }
public ZkSession(IZkRepository respository, ILog logger, IStats stats) { _repository = respository; _logger = logger ?? new NullLogger(); _stats = stats ?? new NullStats(); }