예제 #1
0
		internal LocalRunspaceProvider(int timeoutSeconds, int maxRunspaces, PSLanguageMode? languageMode)
		{
			this._requests = new ConcurrentQueue<LocalRunspaceAsyncResult>();
			this._callbacks = new ConcurrentQueue<LocalRunspaceAsyncResult>();
			this._tracer = PowerShellTraceSourceFactory.GetTraceSource();
			this._runspaceCache = new TimeBasedCache<Runspace>(timeoutSeconds);
			this._maxRunspaces = maxRunspaces;
			this._languageMode = languageMode;
		}
예제 #2
0
 /// <summary>Creates a DhtAddressResolver Object.</summary>
 /// <param name="dht">The dht object to use for dht interactions.</param>
 /// <param name="ipop_namespace">The ipop namespace where the dhcp server
 /// is storing names.</param>
 public DhtAddressResolver(IDht dht, string ipop_namespace)
 {
   _dht = dht;
   _ipop_namespace = ipop_namespace;
   _cache = new TimeBasedCache<MemBlock, Address>(CLEANUP_TIME_MS);
   _attempts = new Dictionary<MemBlock, int>();
   _queued = new Dictionary<MemBlock, bool>();
   _mapping = new Dictionary<Channel, MemBlock>();
 }
예제 #3
0
 /// <summary>Creates a DhtAddressResolver Object.</summary>
 /// <param name="dht">The dht object to use for dht interactions.</param>
 /// <param name="ipop_namespace">The ipop namespace where the dhcp server
 /// is storing names.</param>
 public DhtAddressResolver(IDht dht, string ipop_namespace)
 {
     _dht            = dht;
     _ipop_namespace = ipop_namespace;
     _cache          = new TimeBasedCache <MemBlock, Address>(CLEANUP_TIME_MS);
     _attempts       = new Dictionary <MemBlock, int>();
     _queued         = new Dictionary <MemBlock, bool>();
     _mapping        = new Dictionary <Channel, MemBlock>();
 }
예제 #4
0
파일: ConeNat.cs 프로젝트: pstjuste/brunet
 public ConeNat(TransportAddress ta, int timeout)
 {
   _external_ta = new TransportAddress[1] { ta };
   _internal_ta = new TransportAddress[1] { ((SimulationTransportAddress) ta).Invert() };
   _known_tas = _internal_ta;
   // TBC uses a staged GC, so values are still in after one timeout
   _allowed = new TimeBasedCache<TransportAddress, bool>(timeout / 2);
   _allowed.EvictionHandler += HandleEviction;
   _allow_inbound = false;
 }
예제 #5
0
 /// <summary>Creates a DhtAddressResolver Object.</summary>
 /// <param name="dht">The dht object to use for dht interactions.</param>
 /// <param name="ipop_namespace">The ipop namespace where the dhcp server
 /// is storing names.</param>
 public DhtAddressResolver(IDht dht, string ipop_namespace)
 {
   _dht = dht;
   _ipop_namespace = ipop_namespace;
   _verified_cache = new TimeBasedCache<MemBlock, Address>(CLEANUP_TIME_MS);
   _incoming_cache = new TimeBasedCache<MemBlock, Address>(CLEANUP_TIME_MS);
   _attempts = new Dictionary<MemBlock, int>();
   _queued = new Dictionary<MemBlock, bool>();
   _mapping = new Dictionary<Channel, MemBlock>();
   _udp_client = new UdpClient("127.0.0.1", 55123);
 }
예제 #6
0
파일: ConeNat.cs 프로젝트: kingctan/brunet
 public ConeNat(TransportAddress ta, int timeout)
 {
     _external_ta = new TransportAddress[1] {
         ta
     };
     _internal_ta = new TransportAddress[1] {
         ((SimulationTransportAddress)ta).Invert()
     };
     _known_tas = _internal_ta;
     // TBC uses a staged GC, so values are still in after one timeout
     _allowed = new TimeBasedCache <TransportAddress, bool>(timeout / 2);
     _allowed.EvictionHandler += HandleEviction;
     _allow_inbound            = false;
 }
예제 #7
0
 public OnDemandConnectionOverlord(Node node) : base(node)
 {
   _cache = new TimeBasedCache<Address, bool>(CLEANUP_TIME_MS);
   _cache.EvictionHandler += HandleEviction;
 }
예제 #8
0
 /// <summary>When we get an eviction, we need to consider disconnecting the
 /// connection.</summary>
 protected void HandleEviction(object sender, TimeBasedCache<Address, bool>.EvictionArgs ea)
 {
   DelayedRemove(ea.Key, "No longer needed");
 }
예제 #9
0
 public OnDemandConnectionOverlord(Node node) : base(node)
 {
     _cache = new TimeBasedCache <Address, bool>(CLEANUP_TIME_MS);
     _cache.EvictionHandler += HandleEviction;
 }
예제 #10
0
 /// <summary>When we get an eviction, we need to consider disconnecting the
 /// connection.</summary>
 protected void HandleEviction(object sender, TimeBasedCache <Address, bool> .EvictionArgs ea)
 {
     DelayedRemove(ea.Key, "No longer needed");
 }
예제 #11
0
파일: ConeNat.cs 프로젝트: pstjuste/brunet
 /// <summary>If there are no more entries in the cache, our mapping has, we
 /// will no longer allow inbound connections.</summary>
 private void HandleEviction(object sender,
     TimeBasedCache<TransportAddress, bool>.EvictionArgs ea)
 {
   _allow_inbound = _allowed.Count > 0;
 }
예제 #12
0
파일: ConeNat.cs 프로젝트: kingctan/brunet
 /// <summary>If there are no more entries in the cache, our mapping has, we
 /// will no longer allow inbound connections.</summary>
 private void HandleEviction(object sender,
                             TimeBasedCache <TransportAddress, bool> .EvictionArgs ea)
 {
     _allow_inbound = _allowed.Count > 0;
 }
예제 #13
0
 internal LocalRunspaceProvider(int timeoutSeconds, int maxRunspaces, PSLanguageMode? languageMode)
 {
     _runspaceCache = new TimeBasedCache<Runspace>(timeoutSeconds);
     _maxRunspaces = maxRunspaces;
     _languageMode = languageMode;
 }