Переглянути джерело

Added missing calls to client.stop() in JsonHttpClient.ino (fixes #1485)

Benoit Blanchon 5 роки тому
батько
коміт
c72eccdd35
2 змінених файлів з 5 додано та 0 видалено
  1. 1 0
      CHANGELOG.md
  2. 4 0
      examples/JsonHttpClient/JsonHttpClient.ino

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ HEAD
 ----
 
 * Made `JsonDocument`'s destructor protected (issue #1480)
+* Added missing calls to `client.stop()` in `JsonHttpClient.ino` (issue #1485)
 
 v6.17.2 (2020-11-14)
 -------

+ 4 - 0
examples/JsonHttpClient/JsonHttpClient.ino

@@ -53,6 +53,7 @@ void setup() {
   client.println(F("Connection: close"));
   if (client.println() == 0) {
     Serial.println(F("Failed to send request"));
+    client.stop();
     return;
   }
 
@@ -63,6 +64,7 @@ void setup() {
   if (strcmp(status + 9, "200 OK") != 0) {
     Serial.print(F("Unexpected response: "));
     Serial.println(status);
+    client.stop();
     return;
   }
 
@@ -70,6 +72,7 @@ void setup() {
   char endOfHeaders[] = "\r\n\r\n";
   if (!client.find(endOfHeaders)) {
     Serial.println(F("Invalid response"));
+    client.stop();
     return;
   }
 
@@ -83,6 +86,7 @@ void setup() {
   if (error) {
     Serial.print(F("deserializeJson() failed: "));
     Serial.println(error.f_str());
+    client.stop();
     return;
   }