mirror of
https://github.com/laanwj/k210-sdk-stuff.git
synced 2024-11-22 01:16:20 +04:00
linux: Handle "SEND FAIL" response
UDP sends can fail and then the ESP module returns "SEND FAIL"; we need to handle this, otherwise we'll never consider the send finished.
This commit is contained in:
parent
7220737241
commit
ab95e18ba8
@ -56,7 +56,7 @@ int tun_fd = -1;
|
|||||||
static __attribute__ ((format (printf, 2, 3))) void logprintf(int cls, const char *msg, ...)
|
static __attribute__ ((format (printf, 2, 3))) void logprintf(int cls, const char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list argp;
|
va_list argp;
|
||||||
int attr;
|
int attr = 0;
|
||||||
switch (cls) {
|
switch (cls) {
|
||||||
case INFO1: attr = 95; break;
|
case INFO1: attr = 95; break;
|
||||||
case INFO2: attr = 35; break;
|
case INFO2: attr = 35; break;
|
||||||
@ -65,7 +65,6 @@ static __attribute__ ((format (printf, 2, 3))) void logprintf(int cls, const cha
|
|||||||
if (!debug) {
|
if (!debug) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
attr = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\x1b[%dm", attr);
|
fprintf(stderr, "\x1b[%dm", attr);
|
||||||
@ -346,6 +345,7 @@ static bool esp_read_responses(int fd, bool early_terminate)
|
|||||||
retval = true;
|
retval = true;
|
||||||
}
|
}
|
||||||
if (is_prefix(resp, len, S("FAIL"))
|
if (is_prefix(resp, len, S("FAIL"))
|
||||||
|
|| is_prefix(resp, len, S("SEND FAIL"))
|
||||||
|| is_prefix(resp, len, S("ERROR"))
|
|| is_prefix(resp, len, S("ERROR"))
|
||||||
|| is_prefix(resp, len, S("ALREADY CONNECTED"))) {
|
|| is_prefix(resp, len, S("ALREADY CONNECTED"))) {
|
||||||
finished = true;
|
finished = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user