Skip to content

Commit d5dee30

Browse files
committed
shell/sc_gnrc_udp: don't add delay after last packet
1 parent e22698f commit d5dee30

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sys/shell/commands/sc_gnrc_udp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void _send(const char *addr_str, const char *port_str,
6060
return;
6161
}
6262

63-
for (unsigned int i = 0; i < num; i++) {
63+
while (num--) {
6464
gnrc_pktsnip_t *payload, *udp, *ip;
6565
unsigned payload_size;
6666
/* allocate payload */
@@ -105,11 +105,13 @@ static void _send(const char *addr_str, const char *port_str,
105105
* => use temporary variable for output */
106106
printf("Success: sent %u byte(s) to [%s]:%u\n", payload_size, addr_str,
107107
port);
108+
if (num) {
108109
#if IS_USED(MODULE_ZTIMER_MSEC)
109-
ztimer_sleep(ZTIMER_MSEC, delay);
110+
ztimer_sleep(ZTIMER_MSEC, delay);
110111
#else
111-
xtimer_usleep(delay);
112+
xtimer_usleep(delay);
112113
#endif
114+
}
113115
}
114116
}
115117

0 commit comments

Comments
 (0)