OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
DaemonCommandHandler.cc File Reference
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <signal.h>
#include <sys/wait.h>
#include <cstring>
#include <cstdlib>
#include <cerrno>
#include <sstream>
#include <iostream>
#include <fstream>
#include <map>
#include "DaemonCommandHandler.h"
#include "Connection.h"
#include "Socket.h"
#include "PPTStreamBuf.h"
#include "PPTProtocol.h"
#include "BESXMLUtils.h"
#include "BESInternalFatalError.h"
#include "BESInternalError.h"
#include "BESSyntaxUserError.h"
#include "BESDebug.h"
#include "BESFSFile.h"
#include "BESFSDir.h"
#include "TheBESKeys.h"
#include "BESXMLWriter.h"
#include "BESDaemonConstants.h"
Include dependency graph for DaemonCommandHandler.cc:

Go to the source code of this file.

Functions

void block_signals ()
 
int start_master_beslistener ()
 Start the 'master beslistener' and return its PID. More...
 
bool stop_all_beslisteners (int)
 Stop all of the listeners (both the master listener and all of the child listeners that actually process requests). More...
 
void unblock_signals ()
 

Variables

int master_beslistener_status
 

Function Documentation

void block_signals ( )

Definition at line 166 of file daemon.cc.

Referenced by stop_all_beslisteners().

int start_master_beslistener ( )

Start the 'master beslistener' and return its PID.

This function also sets the global 'master_beslistener_pid' so that other code in this file (like the signal handlers) can have access to it. It starts the beslistener using the global 'arguments' that is a copy of the arguments passed to this daemon.

Note
The globals 'arguments' and 'master_beslistener_pid' are used here (but not passed in) so that they can be kept local to this file. A poor-man's version of encapsulation.
Returns
0 for an error or the PID of the master beslistener

Definition at line 302 of file daemon.cc.

References BESDEBUG, BESLISTENER_PIPE_FD, BESLISTENER_RUNNING, PPTServer::closeConnection(), master_beslistener_status, and update_beslistener_args().

Referenced by main().

Here is the call graph for this function:

bool stop_all_beslisteners ( int  sig)

Stop all of the listeners (both the master listener and all of the child listeners that actually process requests).

A test version of this used the master beslistener's exit status to determine if the daemon should try to restart the master beslistener. That feature is retained so that the daemon can start without listening on the BESDaemonPort, thus eliminating a security issue for sites without a firewall.

Uses the master bestistener's process group to send 'sig' to all of the beslisteners.

Parameters
sigSignal to send to all beslisteners.
Returns
true if the master beslistener status was caught, false otherwise

Definition at line 204 of file daemon.cc.

References BESDEBUG, block_signals(), master_beslistener_status, and unblock_signals().

Here is the call graph for this function:

void unblock_signals ( )

Definition at line 179 of file daemon.cc.

Referenced by stop_all_beslisteners().

Variable Documentation

int master_beslistener_status

Definition at line 93 of file daemon.cc.

Referenced by main(), start_master_beslistener(), and stop_all_beslisteners().