예제 #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;
 }
예제 #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 { };
 }
예제 #3
0
 // TODO: Properly implement this
 void TopLevelNodeServer_NodeDisconnected (CipEntry node)
     => --connections_kept;
예제 #4
0
 // TODO: Properly implement this
 void TopLevelNodeServer_NodeConnected (CipEntry node) {
     ++connections_kept;
     ++total_connections;
 }
예제 #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);