[Aggregator] check_configuration(): port numbers

This commit is contained in:
Matteo Cypriani 2011-03-11 12:53:24 +01:00
parent 2fb30970ad
commit 5c123d769f
1 changed files with 27 additions and 5 deletions

View File

@ -233,6 +233,28 @@ void check_configuration()
exit(ERR_BAD_USAGE) ;
}
// listening_port //
if (cfg_getint(cfg, "listening_port") < 1 ||
cfg_getint(cfg, "listening_port") > 65535)
{
#ifdef DEBUG
fprintf(stderr, "Warning! Bad listening_port:"
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "listening_port", AGGREGATE_DEFAULT_PORT) ;
}
// positioner_port //
if (cfg_getint(cfg, "positioner_port") < 1 ||
cfg_getint(cfg, "positioner_port") > 65535)
{
#ifdef DEBUG
fprintf(stderr, "Warning! Bad positioner_port:"
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "positioner_port", POSITIONER_DEFAULT_PORT) ;
}
// positioner_ip //
if (cfg_getstr(cfg, "positioner_ip")[0] == '\0')
{
@ -247,7 +269,7 @@ void check_configuration()
{
#ifdef DEBUG
fprintf(stderr, "Warning! aggregate_timeout cannot be negative:"
" failing back to default value.\n") ;
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "aggregate_timeout", DEFAULT_AGGREGATE_TIMEOUT) ;
}
@ -257,7 +279,7 @@ void check_configuration()
{
#ifdef DEBUG
fprintf(stderr, "Warning! keep_timeout cannot be negative:"
" failing back to default value.\n") ;
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "keep_timeout", DEFAULT_KEEP_TIMEOUT) ;
}
@ -267,7 +289,7 @@ void check_configuration()
{
#ifdef DEBUG
fprintf(stderr, "Warning! check_interval cannot be negative:"
" failing back to default value.\n") ;
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "check_interval", DEFAULT_CHECK_INTERVAL) ;
}
@ -277,7 +299,7 @@ void check_configuration()
{
#ifdef DEBUG
fprintf(stderr, "Warning! ap_keep_timeout cannot be negative:"
" failing back to default value.\n") ;
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "ap_keep_timeout", DEFAULT_AP_KEEP_TIMEOUT) ;
}
@ -287,7 +309,7 @@ void check_configuration()
{
#ifdef DEBUG
fprintf(stderr, "Warning! ap_check_interval cannot be negative:"
" failing back to default value.\n") ;
" failing back to the default value.\n") ;
#endif // DEBUG
cfg_setint(cfg, "ap_check_interval", DEFAULT_AP_CHECK_INTERVAL) ;
}