Added heartbeat period error message

Added heartbeat period error message and its value in diagnostics
routine
This commit is contained in:
MassimilianoPinto
2015-08-17 14:50:50 +02:00
parent 53c35b05ab
commit 457d3a0f68

View File

@ -403,16 +403,16 @@ int rc = 0;
} }
else if (strcmp(options[i], "heartbeat") == 0) else if (strcmp(options[i], "heartbeat") == 0)
{ {
inst->heartbeat = atoi(value); int h_val = (int)strtol(value, NULL, 10);
if (inst->heartbeat <= 0) {
/* set default value */
inst->heartbeat = BLR_HEARTBEAT_DEFAULT_INTERVAL;
if (h_val <= 0 || (errno == ERANGE)) {
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"Warning : invalid heartbeat period %s." "Warning : invalid heartbeat period %s."
" Setting it to default value %d.", " Setting it to default value %d.",
value, inst->heartbeat ))); value, inst->heartbeat )));
} else {
inst->heartbeat = h_val;
} }
} }
else if (strcmp(options[i], "binlogdir") == 0) else if (strcmp(options[i], "binlogdir") == 0)
@ -973,6 +973,8 @@ struct tm tm;
dcb_printf(dcb, "\tBinlog directory: %s\n", dcb_printf(dcb, "\tBinlog directory: %s\n",
router_inst->binlogdir); router_inst->binlogdir);
dcb_printf(dcb, "\tHeartbeat period (seconds): %lu\n",
router_inst->heartbeat);
dcb_printf(dcb, "\tNumber of master connects: %d\n", dcb_printf(dcb, "\tNumber of master connects: %d\n",
router_inst->stats.n_masterstarts); router_inst->stats.n_masterstarts);
dcb_printf(dcb, "\tNumber of delayed reconnects: %d\n", dcb_printf(dcb, "\tNumber of delayed reconnects: %d\n",