mirror of
https://github.com/laanwj/k210-sdk-stuff.git
synced 2024-11-25 10:56:20 +04:00
linux: Fix false error condition with back-to-back packets
Correct "no progress" check in `esp_read_responses` to avoid issues with back-to-back packets crashing the tunnel.
This commit is contained in:
parent
d1981173f7
commit
6a5f43b411
@ -371,16 +371,17 @@ static bool esp_read_responses(int fd, bool early_terminate)
|
|||||||
|
|
||||||
/* On non-final response, keep reading. */
|
/* On non-final response, keep reading. */
|
||||||
} else {
|
} else {
|
||||||
if (esp_end == ESP_BUFSIZE) {
|
|
||||||
/* Buffer full but command wasn't complete - this isn't good,
|
|
||||||
* exit to prevent looping forever. */
|
|
||||||
my_err("Buffer full with unterminated command");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr += len;
|
ptr += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ptr == 0 && esp_end == ESP_BUFSIZE) {
|
||||||
|
/* Buffer full there was no progress processing responses - this isn't good,
|
||||||
|
* exit to prevent looping forever. */
|
||||||
|
my_err("Buffer full with unterminated command");
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove processed responses from esp_buffer by shifting bytes. */
|
/* Remove processed responses from esp_buffer by shifting bytes. */
|
||||||
memmove(esp_buffer, &esp_buffer[ptr], esp_end - ptr);
|
memmove(esp_buffer, &esp_buffer[ptr], esp_end - ptr);
|
||||||
esp_end -= ptr;
|
esp_end -= ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user