[Client] Improve the request loop
In flood mode, avoid sending a last request when the program is stopped.
This commit is contained in:
parent
d2f0ad78e5
commit
8bec37c4ad
|
@ -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)
|
||||
{
|
||||
send_request() ;
|
||||
if (options.flood_delay >= 0 && owl_run)
|
||||
usleep(options.flood_delay * 1000) ;
|
||||
goto request_transmission ;
|
||||
}
|
||||
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue