FACT++  1.0
void updateFeeServer ( IssueStruct *  issueParam)

Definition at line 2417 of file feeserver.c.

References cleanUp(), createLogMessage(), and i.

Referenced by command_handler().

2417  {
2418 #ifdef ENABLE_MASTERMODE
2419  int status = 0;
2420  int i = 0;
2421  FILE* fp = 0;
2422 
2423  if ((*issueParam).size == 0) {
2424  createLogMessage(MSG_ERROR, "Received new FeeServer with size 0.", 0);
2425  return;
2426  }
2427 # ifdef __DEBUG
2428  printf("Received update command, updating FeeServer now!\n");
2429  fflush(stdout);
2430 # endif
2431  // execute instruction self and release mutex before return
2432  fp = fopen("newFeeserver", "w+b");
2433  if (fp == 0) {
2434  createLogMessage(MSG_ERROR, "Unable to save new FeeServer binary.", 0);
2435  return;
2436  }
2437 
2438  for ( i = 0; i < (*issueParam).size; ++i) {
2439  fputc((*issueParam).command[i], fp);
2440  }
2441  fclose(fp);
2442  createLogMessage(MSG_INFO, "FeeServer updated.", 0);
2443 
2444  // should we call cleanUp() before restart
2445  // better not: another possibility to hang ???
2446  // -> cleanUp is in restart implicit ! except opened drivers
2447  // could only be necessary, if some driver conns have to be closed.
2448  cleanUp();
2449  status = pthread_mutex_unlock(&command_mut);
2450 # ifdef __DEBUG
2451  if (status != 0) {
2452  printf("Unlock FeeCommand mutex error: %d\n", status);
2453  fflush(stdout);
2454  }
2455 # endif
2456 
2457  // Exit status "3" tells the starting script to finalise update and restart
2458  // FeeServer after termination.
2459  exit(3);
2460 #endif //ENABLE_MASTERMODE
2461 }
int i
Definition: db_dim_client.c:21
void cleanUp()
Definition: feeserver.c:3159
void createLogMessage(unsigned int type, char *description, char *origin)
Definition: feeserver.c:1530
static pthread_mutex_t command_mut
Definition: feeserver.c:266

+ Here is the call graph for this function:

+ Here is the caller graph for this function: