Inheritance: IChannelMonitor, IDisposable
 protected override void OnStart()
 {
     base.OnStart();
     if (enabled)
     {
         monitor = new PortMapperMonitor(Application.PeerCast);
         Application.PeerCast.AddChannelMonitor(monitor);
     }
     Task.Run(async() => {
         if (enabled)
         {
             await DiscoverAsync().ConfigureAwait(false);
         }
         var results = await CheckPortAsync().ConfigureAwait(false);
         foreach (var result in results)
         {
             if (!result.Success)
             {
                 continue;
             }
             if (result.IsOpen)
             {
                 Application.PeerCast.SetPortStatus(result.LocalAddress, result.GlobalAddress, PortStatus.Open);
             }
             else
             {
                 Application.PeerCast.SetPortStatus(result.LocalAddress, result.GlobalAddress, PortStatus.Firewalled);
             }
         }
     });
 }
Esempio n. 2
0
 protected override void OnStart()
 {
     base.OnStart();
     if (!enabled) return;
     monitor = new PortMapperMonitor(Application.PeerCast);
     Application.PeerCast.AddChannelMonitor(monitor);
 }
Esempio n. 3
0
 protected override void OnStop()
 {
     if (monitor!=null) {
         Application.PeerCast.RemoveChannelMonitor(monitor);
         monitor.Dispose();
         monitor = null;
     }
     base.OnStop();
 }
Esempio n. 4
0
 protected override void OnStop()
 {
     if (monitor != null)
     {
         Application.PeerCast.RemoveChannelMonitor(monitor);
         monitor.Dispose();
         monitor = null;
     }
     base.OnStop();
 }
Esempio n. 5
0
 protected override void OnStart()
 {
     base.OnStart();
     if (!enabled)
     {
         return;
     }
     monitor = new PortMapperMonitor(Application.PeerCast);
     Application.PeerCast.AddChannelMonitor(monitor);
 }