[Aggregator] Fix autocalibration hello thread

- A second instance of monitor_couples() was threaded instead of
  listen_for_aps() (copy/paste fail!).
- Fix a typo in the config variable "autocalbration_port".
- Add some debug messages.
This commit is contained in:
Matteo Cypriani 2010-10-25 16:36:55 +02:00
parent 2d62705edd
commit 564996262a
1 changed files with 14 additions and 2 deletions

View File

@ -50,7 +50,7 @@ int main(int argc, char **argv)
pthread_create(&monitor_thread, NULL,
(void *) &monitor_couples, NULL) ;
pthread_create(&autocalibration_hello_thread, NULL,
(void *) &monitor_couples, NULL) ;
(void *) &listen_for_aps, NULL) ;
run = TRUE ;
ret = read_loop(sockfd) ;
@ -103,7 +103,7 @@ void parse_config_file(int argc, char **argv)
// Autocalibration activated?
CFG_BOOL("autocalibration", cfg_false, CFGF_NONE),
// Port on which autocalibration data are exchanged:
CFG_INT("autocalbration_port", DEFAULT_AUTOCALIBRATION_PORT,
CFG_INT("autocalibration_port", DEFAULT_AUTOCALIBRATION_PORT,
CFGF_NONE),
// Time we keep APs in the list (in seconds):
CFG_INT("ap_keep_timeout", DEFAULT_AP_KEEP_TIMEOUT, CFGF_NONE),
@ -377,6 +377,10 @@ void* monitor_couples()
couple_info info;
int sockfd;
#ifdef DEBUG
fprintf(stderr, "Monitor couples thread launched.\n") ;
#endif // DEBUG
sockfd = create_udp_sending_socket(cfg_getstr(cfg, "positioner_ip"),
cfg_getint(cfg, "positioner_port"),
&serv, &client) ;
@ -663,6 +667,10 @@ void listen_for_aps(void)
socklen_t client_len = sizeof(client) ; // Size of clients
autocalibration_hello message ;
#ifdef DEBUG
fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
#endif // DEBUG
listen_sockfd =
create_udp_listening_socket(cfg_getint(cfg,
"autocalibration_port")) ;
@ -684,6 +692,10 @@ void listen_for_aps(void)
fprintf(stderr, "No message received from aggregator!\n") ;
continue ;
}
#ifdef DEBUG
else
fprintf(stderr, "Got a Hello message.\n") ;
#endif // DEBUG
update_ap(message.ap_mac_addr_bytes, message.ap_ip_addr) ;
}