Changeset 253 for Evidence/Evidence.cc
- Timestamp:
- 07/20/10 12:34:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Evidence.cc
r232 r253 134 134 ////////////////////////// 135 135 136 // Initialise 136 137 int EvidenceServer::ConfigSignal = 0; 137 138 EvidenceServer *EvidenceServer::This = NULL; 138 139 139 // Constructor starts server with given name140 EvidenceServer::EvidenceServer( const char *ServerName): Name(ServerName) {140 // Constructor 141 EvidenceServer::EvidenceServer(string ServerName): Name(ServerName) { 141 142 142 143 // Initialize … … 176 177 177 178 // Start server 178 start(ServerName );179 start(ServerName.c_str()); 179 180 addExitHandler(this); 180 181 } … … 184 185 185 186 Message(INFO, "Server stopped"); 186 187 187 188 delete ConfClass; 188 delete MessageService; 189 delete[] MessageData; 190 189 191 190 int Ret; 192 191 if ((Ret = pthread_mutex_destroy(&Mutex)) != 0) { 193 192 Message(ERROR, "pthread_mutex_destroy() failed (%s)", strerror(Ret)); 194 193 } 194 195 delete MessageService; 196 delete[] MessageData; 195 197 } 196 198 … … 203 205 204 206 // DIM error handler 205 void EvidenceServer::errorHandler(int Severity, int Code, char *Text) { 207 void EvidenceServer::errorHandler(int Severity, int Code, char *Text) { 208 206 209 Message(ERROR, "%s (DIM error code %d, DIM severity %d)\n", Text, Code, Severity); 207 210 } … … 233 236 SendToLog("%s (%s): %s", MessageService->getName(), StateString[Severity], NewMsg->Text); 234 237 235 // Update DIM message service , then delete old message238 // Update DIM message service 236 239 if (MessageService != NULL) { 237 240 MessageService->updateService(NewMsg, sizeof(struct Message)+strlen(NewMsg->Text)+1); 238 241 } 242 243 // Terminate if severity if FATAL 244 if (Severity == FATAL) exit(EXIT_FAILURE); 245 246 // Delete old message 247 // Note that Lock()/Unlock() might fail with a FATAL message. To avoid an infinite loop, 248 // check for FATAL severity is done before here. 249 Lock(); 239 250 delete[] MessageData; 240 251 MessageData = NewMsg; 241 242 // Terminate if severity if FATAL 243 if (Severity == FATAL) exit(EXIT_FAILURE); 252 Unlock(); 244 253 } 245 254
Note:
See TracChangeset
for help on using the changeset viewer.