cangen: move sleep directly in font of send()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>pull/389/head
parent
96309409c2
commit
1ec8eb9ca1
13
cangen.c
13
cangen.c
|
|
@ -465,6 +465,12 @@ int main(int argc, char **argv)
|
||||||
if (frame.len < maxdlen)
|
if (frame.len < maxdlen)
|
||||||
memset(&frame.data[frame.len], 0, maxdlen - frame.len);
|
memset(&frame.data[frame.len], 0, maxdlen - frame.len);
|
||||||
|
|
||||||
|
if ((ts.tv_sec || ts.tv_nsec) &&
|
||||||
|
burst_sent_count >= burst_count) {
|
||||||
|
if (nanosleep(&ts, NULL))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
printf(" %s ", argv[optind]);
|
printf(" %s ", argv[optind]);
|
||||||
|
|
||||||
|
|
@ -502,14 +508,9 @@ resend:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
burst_sent_count++;
|
|
||||||
if ((ts.tv_sec || ts.tv_nsec) &&
|
|
||||||
burst_sent_count >= burst_count)
|
|
||||||
if (nanosleep(&ts, NULL))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (burst_sent_count >= burst_count)
|
if (burst_sent_count >= burst_count)
|
||||||
burst_sent_count = 0;
|
burst_sent_count = 0;
|
||||||
|
burst_sent_count++;
|
||||||
|
|
||||||
if (id_mode == MODE_INCREMENT)
|
if (id_mode == MODE_INCREMENT)
|
||||||
frame.can_id++;
|
frame.can_id++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue