public StructuredNearConnectionOverlord(Node n)
{
_sync = new Object();
lock( _sync ) {
_node = n;
#if BRUNET_SIMULATOR
_rand = Node.SimulatorRandom;
#else
_rand = new Random();
#endif
_connectors = new Hashtable();
_last_connection_time = DateTime.UtcNow;
/**
* Every heartbeat we assess the trimming situation.
* If we have excess edges and it has been more than
* _trim_wait_time heartbeats then we trim.
*/
_last_retry_time = DateTime.UtcNow;
_current_retry_interval = _DEFAULT_RETRY_INTERVAL;
/**
* Information related to the target selector feature.
* Includes statistics such as trim rate and connection lifetimes.
*/
_start_time = DateTime.UtcNow;
/*
* Register event handlers after everything else is set
*/
//Listen for connection events:
_node.ConnectionTable.DisconnectionEvent += DisconnectHandler;
_node.ConnectionTable.ConnectionEvent += ConnectHandler;
_node.HeartBeatEvent += CheckState;
}
}