diff --git a/owlps-client/owlps-client.c b/owlps-client/owlps-client.c index fdda899..9fcd21c 100644 --- a/owlps-client/owlps-client.c +++ b/owlps-client/owlps-client.c @@ -104,15 +104,11 @@ int main(int argc, char *argv[]) create_socket() ; - request_transmission: - make_packet() ; - send_request() ; - free(packet) ; - - if (options.flood_delay >= 0 && owl_run) + while (owl_run) { - usleep(options.flood_delay * 1000) ; - goto request_transmission ; + send_request() ; + if (options.flood_delay >= 0 && owl_run) + usleep(options.flood_delay * 1000) ; } close(sockfd) ; @@ -379,7 +375,22 @@ void create_socket() -/* Creates the packet to send. */ +/* + * Prepares a new request and sends it. + */ +void send_request() +{ + make_packet() ; + owl_send_request(sockfd, &server, packet, packet_size, + options.nb_pkt, options.delay) ; + free(packet) ; +} + + + +/* + * Creates the packet to send. + */ void make_packet() { uint_fast16_t offset ; // Index used to create the packet @@ -441,14 +452,6 @@ void make_packet() -void send_request() -{ - owl_send_request(sockfd, &server, packet, packet_size, - options.nb_pkt, options.delay) ; -} - - - void receive_position() { // Position of the mobile as computed by the infrastructure: