This page describes the behavior of the LDM 6 program.
When executed, the ldmd program does the following:
Initializes logging and logs a "Starting Up" message.
Establishes an Internet port that will be used for incoming connections. If the program is set-uid-root, then the port number will be 388; otherwise, the port number will be decided by the operating system.
Registers the LDM 5 and LDM 6 services with the RPC portmapper (if it is available) using the port number from the previous step.
Reads the LDM configuration-file, ldmd.conf, and does the following:
Goes into a loop in which it alternately
Accepts the termination of any child processes; and
Listens on the previously-established port for incoming connections from other LDMs. When a connection is made, the program does the following:
Forks an asynchronous copy of itself to service the connection. The child process will be an upstream LDM if the first incoming message is a FEEDME or NOTIFYME; otherwise, if the first incoming message is a HIYA, then the child process will be a downstream LDM.
An upstream LDM does the following:
Computes the intersection of the data-product selection-criteria contained in the FEEDME or NOTIFYME request and the criteria specified in the relevant ALLOW entry.
If the intersection is empty, then then connection is closed and the process terminates; otherwise,
If the intersection is not empty but also not equal the the original request, then the process informs the downstream LDM about the intersection and continues to listen; otherwise,
The process acknowledges the request and begins sending matching data-products from the product-queue to the downstream LDM using the primary or alternate transfer-mode (for FEEDME requests) or NOTIFICATION messages (for NOTIFYME requests).
If the process reaches the end of the product-queue, then it suspends itself for 30 seconds or until reception of a SIGCONT signal (from an ingester or downstream LDM) whichever occurs first.
If nothing has been sent to the downstream LDM in 30 seconds, then the process sends a NULLPROC message.
A downstream LDM does the following:
Sets the initial data-product selection-criteria. The initial "start" time is set as follows:
If a "time offset" option was specified on the ldmd command-line, then the "start" time is set to the current time minus the specified time offset; otherwise,
The "start" time is set to the current time minus the value of the "maximum latency" option (default: 1 hour).
Obtains the metadata of the most recently-received data-product corresponding to the data-product selection-criteria. If the home-directory of the LDM user contains a metadata file corresponding to the data-request and the upstream LDM, then the metadata in that file is read and used; otherwise, the metadata of the most recent data-product in the product-queue that matches the data-product selection-criteria is used.
Encodes into the data-request the data-product signature of the metadata from the previous step, if available, so that the upstream LDM can start sending data-products from where the previous downstream LDM left off.
Enters a loop that terminates when a successful FEEDME request is made to the upstream LDM:
Makes a FEEDME request to the upstream host specified in the REQUEST entry using the current data-product selection-criteria. If the REQUEST entry is the first one with that specific feedtype/pattern pair, then the connection will use the primary transfer-mode; otherwise, the connection will use the alternate alternate transfer-mode.
Receives data-products over the connection contained in HEREIS or COMINGSOON and BLKDATA messages. When the product has completely arrived, it is inserted into the product-queue and a SIGCONT signal is then sent to the LDM process group. The data-product creation-time is used to update the "start" time in the current data-product selection-criteria.
If nothing has been received in 60 seconds, then the process connects to the top-level ldmd on the upstream host and uses an IS_ALIVE message to inquire whether or not the relevant upstream LDM process is still running: