Beispiel #1
0
        /// <summary>
        /// Retrieves all <see cref="IStatusReport" />s created by all applications currently active in the P2P network.
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <IStatusReport> GetRemoteReports()
        {
            IContact bootstrapper = BootstrapperNode.GetContacts().FirstOrDefault();

            if (bootstrapper == null)
            {
                return(new List <IStatusReport>());
            }

            try
            {
                using (
                    ServiceProxy <IDebugServiceHost> proxy =
                        new ServiceProxy <IDebugServiceHost>(bootstrapper.DebugUrl()))
                {
                    return(proxy.Context.GetReports());
                }
            }
            catch (Exception ex)
            {
                if (!Kernel.Exceptions.Exception.IsEndpointDown(ex))
                {
                    Log.Error(ex);
                }
            }
            return(new List <IStatusReport>());
        }
Beispiel #2
0
 public void Execute(ShutdownArgs args)
 {
     foreach (IPeer peer in Peer.Peers)
     {
         peer.Dispose();
     }
     BootstrapperNode.DisposeInstance();
 }
Beispiel #3
0
 /// <summary>
 /// Event raised when the service is started.
 /// </summary>
 /// <param name="args"></param>
 protected override void OnStart(string[] args)
 {
     try
     {
         _bootstrapper     = new BootstrapperNode();
         _debugServiceHost = new DebugServiceHost(_bootstrapper.Node.Contact.DebugUrl());
         _debugServiceHost.Initialize();
     }
     catch (Exception ex)
     {
         Log.Error(ex);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Stores an <see cref="StatusReport" /> remotely.
 /// </summary>
 public void StoreRemotely()
 {
     foreach (IContact bootstrapper in BootstrapperNode.GetContacts())
     {
         try
         {
             using (
                 ServiceProxy <IDebugServiceHost> proxy =
                     new ServiceProxy <IDebugServiceHost>(bootstrapper.DebugUrl()))
             {
                 proxy.Context.Deliver(this);
             }
         }
         catch (Exception ex)
         {
             if (!Kernel.Exceptions.Exception.IsEndpointDown(ex))
             {
                 Log.Error(ex);
             }
         }
     }
 }