mirror of
https://github.com/KevinMidboe/TinyGSM.git
synced 2025-10-29 18:00:18 +00:00
Make sure that modemRead is properly maintaining sock_available
This commit is contained in:
@@ -59,6 +59,8 @@ public:
|
||||
sock_connected = false;
|
||||
|
||||
at->sockets[mux] = this;
|
||||
// ^^ TODO: attach the socket here at init? Or later at connect?
|
||||
// Currently done inconsistently between modems
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -69,6 +71,10 @@ public:
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux);
|
||||
// sock_connected = at->modemConnect(host, port, &mux);
|
||||
// at->sockets[mux] = this;
|
||||
// ^^ TODO: attach the socet after attempting connection or above at init?
|
||||
// Currently done inconsistently between modems
|
||||
return sock_connected;
|
||||
}
|
||||
|
||||
@@ -109,7 +115,7 @@ public:
|
||||
|
||||
virtual int available() {
|
||||
TINY_GSM_YIELD();
|
||||
if (!rx.size()) {
|
||||
if (!rx.size() && sock_connected) {
|
||||
at->maintain();
|
||||
}
|
||||
return rx.size();
|
||||
@@ -183,6 +189,10 @@ public:
|
||||
TINY_GSM_YIELD();
|
||||
rx.clear();
|
||||
sock_connected = at->modemConnect(host, port, mux, true);
|
||||
// sock_connected = at->modemConnect(host, port, &mux);
|
||||
// at->sockets[mux] = this;
|
||||
// ^^ TODO: attach the socet after attempting connection or above at init?
|
||||
// Currently done inconsistently between modems
|
||||
return sock_connected;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user