Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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 { };
 }
Ejemplo n.º 3
0
 // TODO: Properly implement this
 void TopLevelNodeServer_NodeDisconnected (CipEntry node)
     => --connections_kept;
Ejemplo n.º 4
0
 // TODO: Properly implement this
 void TopLevelNodeServer_NodeConnected (CipEntry node) {
     ++connections_kept;
     ++total_connections;
 }
Ejemplo n.º 5
0
 /// <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);