mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
modemRead MUST end with sock_available correct
This commit is contained in:
@@ -100,7 +100,7 @@ TINY_GSM_CLIENT_CONNECT_OVERLOADS()
|
||||
// that it wants from the socket even if it was closed externally.
|
||||
rx.clear();
|
||||
at->maintain();
|
||||
while (sock_available > 0) {
|
||||
while (sock_connected && sock_available > 0) {
|
||||
at->modemRead(TinyGsmMin((uint16_t)rx.free(), sock_available), mux);
|
||||
rx.clear();
|
||||
at->maintain();
|
||||
@@ -601,6 +601,7 @@ protected:
|
||||
streamSkipUntil('\"');
|
||||
waitResponse();
|
||||
DBG("### READ:", len, "from", mux);
|
||||
sockets[mux]->sock_available = modemGetAvailable();
|
||||
return len;
|
||||
}
|
||||
|
||||
@@ -616,8 +617,10 @@ protected:
|
||||
result = stream.readStringUntil('\n').toInt();
|
||||
// if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
|
||||
waitResponse();
|
||||
} else if (res == 3) {
|
||||
streamSkipUntil('\n'); // Skip the error text
|
||||
}
|
||||
if (!result && res != 2 && res != 3) { // Don't check modemGetConnected after an error
|
||||
if (!result) {
|
||||
sockets[mux]->sock_connected = modemGetConnected(mux);
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user