Skip to content

Running the Stack

RELOAD-NET edited this page Dec 17, 2012 · 1 revision

The stack is controlled by a main class named Machine, which implements a state machine maintaining the state of a RELOAD node. The Machine class holds a property ReloadConfig, which is used to configure the stack before its initial start. Some of the most important settings are:

  • IamClient

Specifies whether the instance is started in peer rather than in client mode

  • ListenPort

Specifies the port used to listen for incoming connection attempts. This option is only relevant in the peer mode

  • OverlayName

Specifies the name of the RELOAD overlay and is used for the initial DNS_SRV request to identify the configuration server

  • Logger

Specifies a C# delegate, which is used for logging. The delegate's prototype is void Logger(ReloadGlobals.TRACEFLAGS traces, string s)

Further, the ReloadGlobals class, a member of ReloadConfig, holds additional properties in order to configure the RELOAD stack. Thus, ReloadGlobals is realized as a singleton consisting only of static members. This singleton characteristic is important, as parallel instances of the stack are started within a single program. Basically, values that have to be equal for all instances are specified in this place, as for example:

  • TLS
  • NODE_ID_DIGITS
  • RELOAD_VERSION

An example how to start a RELOAD.NET peer in given below.

public void startPeer(string overlay, int listenPort=2000,  Boolean isClient)
{
    Machine machine = new Machine();
    machine.ReloadConfig.Logger = new ReloadConfig.LogHandler(Logger);
    machine.ReloadConfig.ListenPort = listenPort;
    machine.ReloadConfig.OverlayName = overlay;
    machine.ReloadConfig.DontCheckSSLCert = true;

    machine.StartWorker();
}

Using this code the stack is initialized and a RELOAD node is created. As the StartWorker method is called, the stack initiates the enrollment procedure with a DNS_SRV request based on the overlay name, downloads the configuration document, retrieves the node certificate from the enrollment server, and finally joins the overlay using a bootstrap node defined in the configuration document.

Clone this wiki locally