Beispiel #1
0
 public ItemFilterWindow(TickSpan span, int limit)
 {
     MemorySpan = span;
     Limit      = limit;
 }
Beispiel #2
0
 public TimeWindowDictionary(TickSpan span)
 {
     MemorySpan = span;
 }
Beispiel #3
0
 public override string ToString()
 {
     return($"delta {TickSpan.DebugText( DeltaToNow )}");
 }
Beispiel #4
0
        private void Run()
        {
            var buf  = new byte[65536];
            var buf2 = new byte[65536];

            try
            {
                MulticastSocket.BeginReceiveFrom(buf, 0, buf.Length, SocketFlags.None, ref MLEp, new AsyncCallback(ReceiveMulticast), buf);

                DiscoverDevices();
                Thread.Sleep(1000);
                while (!Terminated)
                {
                    try
                    {
                        DiscoverAction.Do(DiscoverDevices);

                        GetExternalAddressAction.Do(delegate
                        {
                            if (GetExternalAddressAction.Frequency.ToSeconds < 1.0)
                            {
                                GetExternalAddressAction.Frequency = TickSpan.Seconds(60 * 30);
                                GetExternalAddressAction.Start();
                            }

                            if (WANIPConnectionsCtlInfo.Count > 0)
                            {
                                ControlInfo ci;
                                lock ( WANIPConnectionsCtlInfo )
                                {
                                    ci = WANIPConnectionsCtlInfo.Values.First();
                                }
                                RequestExternalIpAddress(ci);
                            }
                        });

                        ExternalPortMappingAction.Do(delegate
                        {
                            if (ExternalPortMappingAction.Frequency.ToSeconds < 1.0)
                            {
                                ExternalPortMappingAction.Frequency = TickSpan.Seconds(LeaseMapDurationSeconds - 200);
                                ExternalPortMappingAction.Start();
                            }

                            if (WANIPConnectionsCtlInfo.Count > 0)
                            {
                                UpdatePortMapping("TCP");
                                UpdatePortMapping("UDP");
                            }
                        });

                        Thread.Sleep(1000);
                    }
                    catch (ThreadAbortException ex)
                    {
                        Logging.Log(ex);
                    }
                    catch (Exception ex)
                    {
                        Logging.Log(ex);
                    }
                }
            }
            finally
            {
                Terminated = true;
            }
        }
Beispiel #5
0
 public PeriodicAction(TickSpan freq, bool hastimedout) : this(freq.ToMilliseconds, hastimedout)
 {
 }
Beispiel #6
0
 public PeriodicAction(TickSpan freq) : this(freq.ToMilliseconds, false)
 {
 }
Beispiel #7
0
 public override string ToString()
 {
     return("TickCounter: delta " + TickSpan.DebugText(DeltaToNow));
 }
Beispiel #8
0
 public PeriodicLogger(DebugUtils.LogLevels level, int freqsec)
 {
     LogLevel  = level;
     LogAction = new PeriodicAction(TickSpan.Seconds(freqsec));
 }
Beispiel #9
0
 public PeriodicLogger(int freqsec)
 {
     LogAction = new PeriodicAction(TickSpan.Seconds(freqsec));
     LogLevel  = DebugUtils.LogLevels.DebugData;
 }