net/emcute: use correct number of retries

syncsend() is used also for the initial packet, so resending
while (retries <= EMCUTE_N_RETRY) is the correct behavior.
This commit is contained in:
Hauke Petersen 2018-05-09 16:22:54 +02:00
parent 202fd41b88
commit 7f2fb5e0a3

View File

@ -118,7 +118,7 @@ static int syncsend(uint8_t resp, size_t len, bool unlock)
* remove was called */ * remove was called */
thread_flags_clear(TFLAGS_ANY); thread_flags_clear(TFLAGS_ANY);
for (unsigned retries = 0; retries < EMCUTE_N_RETRY; retries++) { for (unsigned retries = 0; retries <= EMCUTE_N_RETRY; retries++) {
DEBUG("[emcute] syncsend: sending round %i\n", retries); DEBUG("[emcute] syncsend: sending round %i\n", retries);
sock_udp_send(&sock, tbuf, len, &gateway); sock_udp_send(&sock, tbuf, len, &gateway);
@ -128,7 +128,7 @@ static int syncsend(uint8_t resp, size_t len, bool unlock)
DEBUG("[emcute] syncsend: got response [%i]\n", result); DEBUG("[emcute] syncsend: got response [%i]\n", result);
xtimer_remove(&timer); xtimer_remove(&timer);
res = result; res = result;
retries = EMCUTE_N_RETRY; break;
} }
} }