Changeset 187
- Timestamp:
- 03/29/10 09:28:17 (15 years ago)
- Location:
- Evidence
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Config.cc
r171 r187 36 36 DimService *ConfigModified; 37 37 int ModifyTime; 38 38 39 39 void rpcHandler(); 40 40 … … 45 45 void ConfigChanged(); 46 46 }; 47 47 48 48 49 // Constructor -
Evidence/Evidence.cc
r178 r187 47 47 signal(SIGINT, &SignalHandler); // CTRL-C 48 48 signal(SIGHUP, &SignalHandler); // Terminal closed 49 49 50 50 // Catch C++ unhandled exceptions 51 51 set_terminate(Terminate); … … 57 57 string Rev(EVIDENCE_REVISION); 58 58 Rev = Rev.substr(1, Rev.size()-3); 59 if (asprintf(&InitMsg, "Server started (%s, compiled %s %s)", Rev.c_str(),__DATE__, __TIME__) == -1) InitMsg = NULL;59 snprintf(InitMsg, sizeof(InitMsg), "Server started (%s, compiled %s %s)", Rev.c_str(),__DATE__, __TIME__); 60 60 61 61 Status = new DimService((ServerName+"/Status").c_str(), (char *) "C", InitMsg, strlen(InitMsg)+1); … … 68 68 EvidenceServer::~EvidenceServer() { 69 69 70 free(InitMsg);71 70 State(INFO, "Server stopped"); 72 71 … … 79 78 // DIM exit handler 80 79 void EvidenceServer::exitHandler(int Code) { 80 81 81 State(INFO, "Exit handler called (DIM exit code %d)", Code); 82 82 exit(EXIT_SUCCESS); … … 181 181 182 182 // Signal handler (causes pause() and other syscalls to return) 183 void EvidenceServer::SignalHandler(int) { 184 185 ThisServer->ExitRequest = true; 183 void EvidenceServer::SignalHandler(int Signal) { 184 185 static bool Called = false; 186 187 if (!Called) { 188 Called = true; 189 ThisServer->ExitRequest = true; 190 return; 191 } 192 193 // If invoked twice, call exit() 194 ThisServer->State(ThisServer->WARN, "Signal handler called again, invoking exit() (signal %d)", Signal); 195 exit(EXIT_FAILURE); 186 196 } 187 197 -
Evidence/Evidence.h
r178 r187 20 20 class EvidenceServer: public DimServer { 21 21 private: 22 23 22 // This class will contain in LastModifyTime always 24 23 // the unix time of the last config file update … … 51 50 class ConfigUpdate *ModifyInfo; 52 51 53 char *InitMsg;52 char InitMsg[STATUS_SIZE]; 54 53 int LastModifyTime; 55 54 -
Evidence/readme.txt
r186 r187 5 5 Config is the configuration server and needs to run before any other DIM 6 6 server that requests configuration information is started (if a configuration 7 request cannot be answered, a server will normally not start). As default, 8 it reads Evidence.conf in the config subdirectory. A different configuration 7 request cannot be answered, a server will normally not start). A configuration 9 8 file can be given on the command line. 10 9 … … 18 17 19 18 The DIMDIR environment variable needs to point to the DIM installation directory 20 when compiling. DIM_DNS_NODE must point to aname server for any DIM server19 when compiling. DIM_DNS_NODE must point to the name server for any DIM server 21 20 to run. 22 21
Note:
See TracChangeset
for help on using the changeset viewer.