Skip to content

Commit dddb014

Browse files
committed
Update TCP parse loop to current paradigm
Extend previous OWM fix to all occurrences of the same parse loop pattern.
1 parent faf1f22 commit dddb014

13 files changed

+13
-13
lines changed

examples/PlaneSpotterDemo/AdsbExchangeClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void AdsbExchangeClient::updateVisibleAircraft(String searchQuery) {
4545

4646
int size = 0;
4747
client.setNoDelay(false);
48-
while(client.connected()) {
48+
while(client.available() || client.connected()) {
4949
while((size = client.available()) > 0) {
5050
c = client.read();
5151
if (c == '{' || c == '[') {

src/AerisForecasts.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void AerisForecasts::doUpdate(AerisForecastData *forecasts, String url, uint8_t
5858

5959
WiFiClient * client = http.getStreamPtr();
6060

61-
while(client->connected()) {
61+
while(client->available() || client->connected()) {
6262
while((size = client->available()) > 0) {
6363
if ((millis() - lost_do) > lostTest) {
6464
Serial.println ("lost in client with a timeout");

src/AerisObservations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void AerisObservations::doUpdate(AerisObservationsData *observations, String url
5656

5757
WiFiClient * client = http.getStreamPtr();
5858

59-
while(client->connected()) {
59+
while(client->available() || client->connected()) {
6060
while((size = client->available()) > 0) {
6161
if ((millis() - lost_do) > lostTest) {
6262
Serial.println ("lost in client with a timeout");

src/AerisSunMoon.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void AerisSunMoon::doUpdate(AerisSunMoonData *sunMoonData, String url) {
5757

5858
WiFiClient * client = http.getStreamPtr();
5959

60-
while(client->connected()) {
60+
while(client->available() || client->connected()) {
6161
while((size = client->available()) > 0) {
6262
if ((millis() - lost_do) > lostTest) {
6363
Serial.println ("lost in client with a timeout");

src/ThingspeakClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void ThingspeakClient::getLastChannelItem(String channelId, String readApiKey) {
4545

4646
int size = 0;
4747
client.setNoDelay(false);
48-
while(client.connected()) {
48+
while(client.available() || client.connected()) {
4949
while((size = client.available()) > 0) {
5050
c = client.read();
5151
if (c == '{' || c == '[') {

src/TimeClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void TimeClient::updateTime() {
5656

5757
int size = 0;
5858
client.setNoDelay(false);
59-
while(client.connected()) {
59+
while(client.available() || client.connected()) {
6060
while((size = client.available()) > 0) {
6161
line = client.readStringUntil('\n');
6262
line.toUpperCase();

src/WorldClockClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void WorldClockClient::updateTime() {
9393

9494
int size = 0;
9595
client.setNoDelay(false);
96-
while(client.connected()) {
96+
while(client.available() || client.connected()) {
9797
while((size = client.available()) > 0) {
9898
c = client.read();
9999
if (c == '{' || c == '[') {

src/WundergroundAlerts.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void WundergroundAlerts::doUpdate(WGAlert *alerts, uint8_t maxAlerts, String url
8282

8383
WiFiClient * client = http.getStreamPtr();
8484

85-
while(client->connected()) {
85+
while(client->available() || client->connected()) {
8686
while((size = client->available()) > 0) {
8787
c = client->read();
8888
if (c == '{' || c == '[') {

src/WundergroundAstronomy.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void WundergroundAstronomy::doUpdate(WGAstronomy *astronomy, String url) {
6868

6969
WiFiClient * client = http.getStreamPtr();
7070

71-
while(client->connected()) {
71+
while(client->available() || client->connected()) {
7272
while((size = client->available()) > 0) {
7373
c = client->read();
7474
if (c == '{' || c == '[') {

src/WundergroundClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ void WundergroundClient::doUpdate(String url) {
162162
parser.parse(c);
163163
}
164164
}
165-
} while(client.connected());
165+
} while(client.available() || client.connected());
166166
}
167167

168168
void WundergroundClient::whitespace(char c) {

src/WundergroundConditions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void WundergroundConditions::doUpdate(WGConditions *conditions, String url) {
7272

7373
WiFiClient * client = http.getStreamPtr();
7474

75-
while(client->connected()) {
75+
while(client->available() || client->connected()) {
7676
while((size = client->available()) > 0) {
7777
if ((millis() - lost_do) > lostTest) {
7878
Serial.println ("lost in client with a timeout");

src/WundergroundForecast.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void WundergroundForecast::doUpdate(WGForecast *forecasts, uint8_t maxForecasts,
7474

7575
WiFiClient * client = http.getStreamPtr();
7676

77-
while(client->connected()) {
77+
while(client->available() || client->connected()) {
7878
while((size = client->available()) > 0) {
7979
if ((millis() - lost_do) > lostTest) {
8080
Serial.println ("lost in client with a timeout");

src/WundergroundHourly.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void WundergroundHourly::doUpdate(WGHourly *hourlies, String url) {
7272
if(httpCode > 0) {
7373
WiFiClient * client = http.getStreamPtr();
7474

75-
while(client->connected()) {
75+
while(client->available() || client->connected()) {
7676
while((size = client->available()) > 0) {
7777
c = client->read();
7878
if (c == '{' || c == '[') {

0 commit comments

Comments
 (0)