Skip to content

Commit e81af05

Browse files
committed
Resolved issue esp8266#3359
Made severing connections optional as per the patch in the issue. Also fixed a minor spacing issue.
1 parent bea64df commit e81af05

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

100644100755
+4-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,10 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&
345345

346346
WiFiClient * tcp = http.getStreamPtr();
347347

348-
WiFiUDP::stopAll();
349-
WiFiClient::stopAllExcept(tcp);
348+
if (_severConnectionsOnUpdate) {
349+
WiFiUDP::stopAll();
350+
WiFiClient::stopAllExcept(tcp);
351+
}
350352

351353
delay(100);
352354

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

100644100755
+7-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ class ESP8266HTTPUpdate
8787
_followRedirects = follow;
8888
}
8989

90+
void severConnectionsOnUpdate(bool sever)
91+
{
92+
_severConnectionsOnUpdate = sever;
93+
}
94+
9095
void setLedPin(int ledPin = -1, uint8_t ledOn = HIGH)
9196
{
9297
_ledPin = ledPin;
@@ -146,12 +151,13 @@ class ESP8266HTTPUpdate
146151
// Set the error and potentially use a CB to notify the application
147152
void _setLastError(int err) {
148153
_lastError = err;
149-
if (_cbError) {
154+
if (_cbError) {
150155
_cbError(err);
151156
}
152157
}
153158
int _lastError;
154159
bool _rebootOnUpdate = true;
160+
bool _severConnectionsOnUpdate = true;
155161
private:
156162
int _httpClientTimeout;
157163
bool _followRedirects;

0 commit comments

Comments
 (0)