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