Checking for connected socket

This commit is contained in:
Sara Damiano
2018-09-13 16:48:12 -04:00
parent 9ff666a855
commit 30072cf173
2 changed files with 3 additions and 3 deletions

View File

@@ -115,7 +115,7 @@ public:
virtual int available() {
TINY_GSM_YIELD();
if (!rx.size()) {
if (!rx.size() && sock_connected) {
at->maintain();
}
return rx.size() + sock_available;
@@ -125,7 +125,7 @@ public:
TINY_GSM_YIELD();
at->maintain();
size_t cnt = 0;
while (cnt < size) {
while (cnt < size && sock_connected) {
size_t chunk = TinyGsmMin(size-cnt, rx.size());
if (chunk > 0) {
rx.get(buf, chunk);

View File

@@ -123,7 +123,7 @@ public:
TINY_GSM_YIELD();
at->maintain();
size_t cnt = 0;
while (cnt < size) {
while (cnt < size && sock_connected) {
size_t chunk = TinyGsmMin(size-cnt, rx.size());
if (chunk > 0) {
rx.get(buf, chunk);