diff --git a/libowlps/libowlps.c b/libowlps/libowlps.c index 010d7b1..4641b46 100644 --- a/libowlps/libowlps.c +++ b/libowlps/libowlps.c @@ -9,7 +9,7 @@ #define DEBUG -owl_bool run = TRUE ; +owl_bool owl_run = TRUE ; @@ -448,7 +448,7 @@ void owl_sigint_handler(int num) exit(ERR_BAD_SIGNAL) ; } - run = FALSE ; + owl_run = FALSE ; #ifdef DEBUG fprintf(stderr, "\nSignal received: end.\n"); diff --git a/libowlps/owlps.h b/libowlps/owlps.h index d3ced8c..9aaf21e 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -238,7 +238,8 @@ typedef struct _owl_autocalibration_order /* Global variables */ -extern owl_bool run ; +// Used to handle end of loops: +extern owl_bool owl_run ; /* Function error codes */ diff --git a/owlps-aggregator/owlps-aggregatord.c b/owlps-aggregator/owlps-aggregatord.c index f62fff8..df9a99c 100644 --- a/owlps-aggregator/owlps-aggregatord.c +++ b/owlps-aggregator/owlps-aggregatord.c @@ -78,7 +78,7 @@ int main(int argc, char **argv) } } - run = TRUE ; + owl_run = TRUE ; ret = read_loop(sockfd) ; /* Wait for the threads to terminate */ @@ -387,14 +387,14 @@ int read_loop(int sockfd) request_time_str[OWL_TIMESTAMP_STR_LEN], start_time_str[OWL_TIMESTAMP_STR_LEN] ; - while (run) + while (owl_run) { nread = recvfrom(sockfd, &request, sizeof(request), 0, (struct sockaddr *) &client, &client_len) ; if (nread <= 0) { - if (run) + if (owl_run) { fprintf(stderr, "No request received from client!\n") ; ret = ERR_NO_MESSAGE_RECEIVED ; @@ -507,7 +507,7 @@ void* monitor_requests(void *NULL_value) } pthread_cleanup_push(&owl_close_file, &fd) ; - while (run) + while (owl_run) { request_ptr = requests ; request_prev = NULL ; @@ -829,14 +829,14 @@ void* listen_for_aps(void *NULL_value) } pthread_cleanup_push(&owl_close_fd, &listen_sockfd) ; - while (run) + while (owl_run) { nread = recvfrom(listen_sockfd, &message, sizeof(message), 0, (struct sockaddr *) &client, &client_len) ; - if (nread <= 0 && run) + if (nread <= 0 && owl_run) { - if (run) + if (owl_run) fprintf(stderr, "No message received from listener!\n") ; continue ; } @@ -978,7 +978,7 @@ void* monitor_aps(void *NULL_value) fprintf(stderr, "Monitor AP thread launched.\n") ; #endif // DEBUG - while (run) + while (owl_run) { delete_old_aps() ; diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index 8693839..baa6568 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) program_name = argv[0] ; initialise_configuration(argc, argv) ; - run = TRUE ; + owl_run = TRUE ; /* Set up signal handlers */ sigemptyset(&action.sa_mask) ; @@ -565,7 +565,7 @@ void* keep_mode_monitor(void *iface) if (GET_VERBOSE()) fprintf(stderr, "Thread for keeping monitor mode launched.\n") ; - while (run) + while (owl_run) { // Switch the interface to monitor mode: owl_iface_mode_monitor((char*) iface) ; @@ -601,7 +601,7 @@ int capture() GET_AGGREGATION_PORT(), &aggregation_server, NULL) ; - while (run) + while (owl_run) // Capture one packet at time, and call read_packet() on it: pcap_loop(capture_handler, 1, read_packet, NULL) ; @@ -1049,7 +1049,7 @@ void* autocalibrate_hello(void *NULL_value) memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ; - while (run) + while (owl_run) { owlclient_send_packet(send_sockfd, &serv, &message, sizeof(message)) ; @@ -1093,14 +1093,14 @@ void* autocalibrate(void *NULL_value) } pthread_cleanup_push(&owl_close_fd, &listen_sockfd) ; - while (run) + while (owl_run) { nread = recvfrom(listen_sockfd, &message, sizeof(message), 0, (struct sockaddr *) &client, &client_len) ; - if (nread <= 0 && run) + if (nread <= 0 && owl_run) { - if (run) + if (owl_run) fprintf(stderr, "No message received from aggregator!\n") ; continue ; }