mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-09 10:32:53 +03:00
Merge pull request #228 from mrdeep1/loss-level-restore
src/debug.c: Allow loss level of 0% to restore full flow
This commit is contained in:
1 file changed
+4
-1
+4
-1
@@ -697,13 +697,16 @@ int coap_debug_set_packet_loss(const char *loss_level) {
|
||||
const char *p = loss_level;
|
||||
char *end = NULL;
|
||||
int n = (int)strtol(p, &end, 10), i = 0;
|
||||
if (end == p || n <= 0)
|
||||
if (end == p || n < 0)
|
||||
return 0;
|
||||
if (*end == '%') {
|
||||
if (n > 100)
|
||||
n = 100;
|
||||
packet_loss_level = n * 65536 / 100;
|
||||
coap_log(LOG_DEBUG, "packet loss level set to %d%%\n", n);
|
||||
} else {
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
while (i < 10) {
|
||||
packet_loss_intervals[i].start = n;
|
||||
if (*end == '-') {
|
||||
|
||||
Reference in new issue
Block a user