From 5c123d769f0821ae7e78cf5f4196025841cb720c Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 11 Mar 2011 12:53:24 +0100 Subject: [PATCH] [Aggregator] check_configuration(): port numbers --- .../owlps-aggregator/owlps-aggregatord.c | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c index b9d167f..8ea559c 100644 --- a/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c +++ b/infrastructure-centred/owlps-aggregator/owlps-aggregatord.c @@ -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) ; }