public NodeInformation(CipEntry cip, int total_allowed_clients, int max_concurrent_clients) { entry = cip; uptime = new TimeSpan (0, 0, 0, 0, 0); now = DateTime.Now; TotalAllowedClients = total_allowed_clients; MaxConcurrentClients = max_concurrent_clients; }
public TopLevelNodeServer (IPAddress ip, int port) { listener = new TcpListener (ip, port); tksource = new CancellationTokenSource (); self = CipEntry.GenerateFor (new IPEndPoint (ip, port), CipNodeType.TopLevelNode); info = new NodeInformation (self, MAX_CONNECTIONS, MAX_CONCURRENT_CONNECTIONS); NodeConnected += TopLevelNodeServer_NodeConnected; NodeDisconnected += TopLevelNodeServer_NodeDisconnected; UpdateTriggered += delegate { }; }
// TODO: Properly implement this void TopLevelNodeServer_NodeDisconnected (CipEntry node) => --connections_kept;
// TODO: Properly implement this void TopLevelNodeServer_NodeConnected (CipEntry node) { ++connections_kept; ++total_connections; }
/// <summary> /// Adds a node to the 'cips' table. /// </summary> /// <returns><c>true</c>, if the node was added, <c>false</c> otherwise.</returns> /// <param name="cip">cIP entry.</param> public bool AddNode (CipEntry cip) => AddNode (cip.Value, cip.Type);