cangen: move sleep directly in font of send()

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde
2022-12-07 16:45:21 +01:00
parent 96309409c2
commit 1ec8eb9ca1
+7 -6
View File
@@ -465,6 +465,12 @@ int main(int argc, char **argv)
if (frame.len < maxdlen)
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) {
printf(" %s ", argv[optind]);
@@ -502,14 +508,9 @@ resend:
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)
burst_sent_count = 0;
burst_sent_count++;
if (id_mode == MODE_INCREMENT)
frame.can_id++;