[i-c] Make more verbose autocalibration exchanges
When in debug mode, aggregator and listener both output information when sending or receiving autocalibration hello messages or orders.
This commit is contained in:
parent
564996262a
commit
05ceea9950
|
@ -30,6 +30,7 @@
|
|||
#define ERR_CREATING_SOCKET 2 // Erreur when creating listening socket
|
||||
#define ERR_BAD_USAGE 3 // Bad program call
|
||||
#define ERR_PARSING_CONFIG_FILE 4 // Error reading the configuration file
|
||||
#define ERR_SENDING_INFO 5 // Error sending a message on a socket
|
||||
|
||||
|
||||
/* Linked list storing data of couples MAC / sequence number */
|
||||
|
|
|
@ -692,9 +692,9 @@ void listen_for_aps(void)
|
|||
fprintf(stderr, "No message received from aggregator!\n") ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
else
|
||||
fprintf(stderr, "Got a Hello message.\n") ;
|
||||
fprintf(stderr, "Got a Hello message.\n") ;
|
||||
#endif // DEBUG
|
||||
|
||||
update_ap(message.ap_mac_addr_bytes, message.ap_ip_addr) ;
|
||||
|
@ -870,14 +870,26 @@ void order_send(ap_list *ap)
|
|||
struct sockaddr_in serv;
|
||||
struct sockaddr_in client ;
|
||||
socklen_t serv_len = sizeof(serv);
|
||||
int sockfd =
|
||||
int sockfd ;
|
||||
ssize_t nsent ;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Sending an order to %s...\n", ap->ip_addr) ;
|
||||
#endif // DEBUG
|
||||
|
||||
sockfd =
|
||||
create_udp_sending_socket(ap->ip_addr,
|
||||
cfg_getint(cfg, "autocalibration_port"),
|
||||
&serv, &client) ;
|
||||
|
||||
message.order = AUTOCALIBRATION_ORDER_SEND ;
|
||||
sendto(sockfd, (void *)&message, sizeof(message), 0,
|
||||
(struct sockaddr *)&serv, serv_len) ;
|
||||
nsent = sendto(sockfd, (void *)&message, sizeof(message), 0,
|
||||
(struct sockaddr *)&serv, serv_len) ;
|
||||
if (nsent != (ssize_t) sizeof(message))
|
||||
{
|
||||
perror("Error sending order to the listener") ;
|
||||
exit(ERR_SENDING_INFO) ;
|
||||
}
|
||||
|
||||
(void) close(sockfd) ;
|
||||
}
|
||||
|
@ -1011,7 +1023,8 @@ void print_usage()
|
|||
"\t%s [-f config_file] [-l listening_port] [-i positionner_ip]"
|
||||
" [-p positioner_port] [-t aggregate_timeout] [-k keep_timeout]"
|
||||
" [-c check_interval] [-o output_file] [-A]"
|
||||
" [-a autocalibration_port]\n"
|
||||
" [-a autocalibration_port] [-K ap_keep_timeout]"
|
||||
" [-C ap_check_interval]\n"
|
||||
|
||||
"Main options:\n"
|
||||
"\t-h\t\tPrint this help.\n"
|
||||
|
@ -1031,7 +1044,7 @@ void print_usage()
|
|||
" 'aggregate_timeout' milliseconds before to be grouped"
|
||||
" (default: %d ms).\n"
|
||||
"\t-k keep_timeout\t\tAggregated requests are kept during"
|
||||
" 'keep_timeout' milliseconds (default: %d milliseconds).\n"
|
||||
" 'keep_timeout' milliseconds (default: %d ms).\n"
|
||||
"\t-c check_interval\tTime between two checks of the stored"
|
||||
" requests (default\t%d microseconds).\n"
|
||||
|
||||
|
|
|
@ -918,12 +918,16 @@ void autocalibrate()
|
|||
}
|
||||
|
||||
if (message.order == AUTOCALIBRATION_ORDER_SEND)
|
||||
send_autocalibration_request() ;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "I just was ordered to send an autocalibration"
|
||||
" request...\n") ;
|
||||
#endif // DEBUG
|
||||
send_autocalibration_request() ;
|
||||
}
|
||||
else
|
||||
fprintf(stderr,
|
||||
"Autocalibration order unknown: %d.\n", message.order) ;
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
(void) close(listen_sockfd) ;
|
||||
|
|
Loading…
Reference in New Issue