FACT++  1.0
bool checkReplicatedLogMessage ( )

Definition at line 2202 of file feeserver.c.

References dis_update_service, sprintf(), and time.

Referenced by createLogMessage(), and runLogWatchDog().

2202  {
2203  int tempLength = 0;
2204  time_t timeVal;
2205  struct tm* now = 0;
2206 
2207  // check if replicated messages are pending
2208  if (replicatedMsgCount > 0) {
2209  // replicated messages occured in between, informing upper layer ...
2210  message.description[sprintf(message.description,
2211  "Log message repeated %d times: ", replicatedMsgCount)] = 0;
2212  // append original message as far as possible
2213  tempLength = strlen(message.description);
2214  if ((strlen(lastMessage.description) + tempLength) >=
2215  MSG_DESCRIPTION_SIZE) {
2216  // copy only a part of the original message that fits in the
2217  // description field
2218  strncpy((message.description + tempLength), lastMessage.description,
2219  (MSG_DESCRIPTION_SIZE - tempLength));
2220  message.description[MSG_DESCRIPTION_SIZE - 1] = 0;
2221  } else {
2222  // enough space free, copy the whole original message
2223  strcpy((message.description + tempLength),
2224  lastMessage.description);
2225  message.description[strlen(lastMessage.description) +
2226  tempLength - 1] = 0;
2227  }
2228  // set correct timestamp
2229  time(&timeVal);
2230  now = localtime(&timeVal);
2231  message.date[strftime(message.date, MSG_DATE_SIZE, "%Y-%m-%d %H:%M:%S",
2232  now)] = 0;
2233 
2234  //update MsgService with notification of repeated messages
2236  // clearing counter
2237  replicatedMsgCount = 0;
2238  return true;
2239  }
2240  return false;
2241 }
static MessageStruct message
Definition: feeserver.c:101
#define dis_update_service
Definition: dis.h:18
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
static unsigned short replicatedMsgCount
Definition: feeserver.c:114
static MessageStruct lastMessage
Definition: feeserver.c:108
sprintf(name1,"NewService%d", i)
static unsigned int messageServiceID
Definition: feeserver.c:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function: