コード例 #1
0
        /**
         * <summary>Sets up a proper Shutdown for the given system if one exists.  Call
         * this method rather than attempting to setup your own.</summary>
         * <returns>The native shutdown class is returned.</returns>
         */
        public static Shutdown GetShutdown()
        {
            Shutdown sd = null;

            try {
                if (OSDependent.OSVersion == OSDependent.OS.Linux)
                {
                    sd = new LinuxShutdown();
                }
                else if (OSDependent.OSVersion == OSDependent.OS.Windows)
                {
                    sd = new WindowsShutdown();
                }
                else
                {
                    sd = new Shutdown();
                }
            }
            catch {
                if (OSDependent.OSVersion == OSDependent.OS.Linux)
                {
                    Console.WriteLine("Shutting down via ctrl-c will not work, perhaps " +
                                      "you do not have the Mono.Posix libraries installed");
                }
                sd = new Shutdown();
            }
            return(sd);
        }
コード例 #2
0
ファイル: BasicNode.cs プロジェクト: pcbing/brunet
        /// <summary>Prepares a BasicNode.</summary>
        /// <param name="node_config">A node config object.</param>
        public BasicNode(NodeConfig node_config)
        {
            _node_config      = node_config;
            _running          = true;
            _shutdown         = Shutdown.GetShutdown();
            _shutdown.OnExit += OnExit;

            _type_to_pem = new Dictionary <string, PathELManager>();
            _rand        = new Random();
        }
コード例 #3
0
ファイル: BasicNode.cs プロジェクト: ikaragkiozoglou/brunet
        /// <summary>Prepares a BasicNode.</summary>
        /// <param name="node_config">A node config object.</param>
        public BasicNode(NodeConfig node_config)
        {
            _node_config      = node_config;
            _running          = true;
            _shutdown         = Shutdown.GetShutdown();
            _shutdown.OnExit += OnExit;

            _type_to_pem = new Dictionary <string, PathELManager>();
            _rand        = new Random();

            if (_node_config.XmppServices.Enabled)
            {
                XmppService = new XmppService(_node_config.XmppServices.Username,
                                              _node_config.XmppServices.Password,// _node_config.XmppServices.Server,
                                              _node_config.XmppServices.Port);
                XmppService.Connect();
            }
        }
コード例 #4
0
 /**
 <summary>Sets up a proper Shutdown for the given system if one exists.  Call
 this method rather than attempting to setup your own.</summary>
 <returns>The native shutdown class is returned.</returns>
 */
 public static Shutdown GetShutdown() {
   Shutdown sd = null;
   try {
     if(OSDependent.OSVersion == OSDependent.OS.Linux) {
       sd = new LinuxShutdown();
     }
     else if(OSDependent.OSVersion == OSDependent.OS.Windows) {
       sd = new WindowsShutdown();
     }
     else {
       sd = new Shutdown();
     }
   }
   catch {
     if(OSDependent.OSVersion == OSDependent.OS.Linux) {
       Console.WriteLine("Shutting down via ctrl-c will not work, perhaps " +
           "you do not have the Mono.Posix libraries installed");
     }
     sd = new Shutdown();
   }
   return sd;
 }
コード例 #5
0
ファイル: BasicNode.cs プロジェクト: hseom/brunet
    /// <summary>Prepares a BasicNode.</summary>
    /// <param name="node_config">A node config object.</param>
    public BasicNode(NodeConfig node_config)
    {
      _node_config = node_config;
      _running = true;
      _shutdown = Shutdown.GetShutdown();
      _shutdown.OnExit += OnExit;

      _type_to_pem = new Dictionary<string, PathELManager>();
      _rand = new Random();

      if(_node_config.XmppServices.Enabled) {
        XmppService = new XmppService(_node_config.XmppServices.Username,
            _node_config.XmppServices.Password,// _node_config.XmppServices.Server,
            _node_config.XmppServices.Port);
        XmppService.Connect();
      }
    }
コード例 #6
0
ファイル: BasicNode.cs プロジェクト: hseom/hseom_brunet
 /// <summary>Prepares a BasicNode.</summary>
 /// <param name="node_config">A node config object.</param>
 public BasicNode(NodeConfig node_config) {
   _node_config = node_config;
   _running = true;
   _shutdown = Shutdown.GetShutdown();
 }
コード例 #7
0
ファイル: BasicNode.cs プロジェクト: myidpt/brunet
    /**
    <summary>Starts services such as shutdown, rpcdht, and xmlrpc.  If you wish
    to have your own shutdown path, edit OnExit instead of this.  This can be
    called multiple times without negative effect.</summary>
    */
    public virtual void StartServices() {
      _shutdown = Shutdown.GetShutdown();
      if(_shutdown != null) {
        _shutdown.OnExit += OnExit;
      }

      if(_node_config.RpcDht != null && _node_config.RpcDht.Enabled) {
        if(_ds == null) {
          _ds = new DhtServer(_node_config.RpcDht.Port);
        }
        _ds.Update(_dht);
      }

      if(_node_config.XmlRpcManager != null && _node_config.XmlRpcManager.Enabled) {
        if(_xrm == null) {
          _xrm = new XmlRpcManagerServer(_node_config.XmlRpcManager.Port);
        }
        _xrm.Update(_node);
      }
    }
コード例 #8
0
    /**
    <summary>Starts services such as shutdown, rpcdht, and xmlrpc.  If you wish
    to have your own shutdown path, edit OnExit instead of this.  This can be
    called multiple times without negative effect.</summary>
    */
    public virtual void StartServices() {
      _shutdown = Shutdown.GetShutdown();
      if(_shutdown != null) {
        _shutdown.OnExit += OnExit;
      }
      
      if(_c_node_config.RpcDht != null && _c_node_config.RpcDht.Enabled) {
        if(_c_ds == null) {
          _c_ds = new DhtServer(_c_node_config.RpcDht.Port);
        }
        _c_ds.Update(_c_dht,"cache");
      }
      if(_q_node_config.RpcDht != null && _q_node_config.RpcDht.Enabled) {
        if(_q_ds == null) {
          _q_ds = new DhtServer(_q_node_config.RpcDht.Port);
        }
        _q_ds.Update(_q_dht,"query");
      }

      if(_c_node_config.XmlRpcManager != null && _c_node_config.XmlRpcManager.Enabled) {
        if(_c_xrm == null) {
          _c_xrm = new XmlRpcManagerServer(_c_node_config.XmlRpcManager.Port);
        }
        _c_xrm.Update(_c_node,"cache");
      }
      if(_q_node_config.XmlRpcManager != null && _q_node_config.XmlRpcManager.Enabled) {
        if(_q_xrm == null) {
          _q_xrm = new XmlRpcManagerServer(_q_node_config.XmlRpcManager.Port);
        }
        _q_xrm.Update(_q_node,"query");
      }

    }
コード例 #9
0
ファイル: BasicNode.cs プロジェクト: johnynek/brunet
    /// <summary>Prepares a BasicNode.</summary>
    /// <param name="node_config">A node config object.</param>
    public BasicNode(NodeConfig node_config)
    {
      _node_config = node_config;
      _running = true;
      _shutdown = Shutdown.GetShutdown();
      _shutdown.OnExit += OnExit;

      _type_to_pem = new Dictionary<string, PathELManager>();
      _rand = new Random();
    }