Skip to content

Commit

Permalink
Resolved issue esp8266#3359
Browse files Browse the repository at this point in the history
Made severing connections optional as per the patch
in the issue.
Also fixed a minor spacing issue.
  • Loading branch information
timstableford committed Feb 22, 2020
1 parent bea64df commit e81af05
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ HTTPUpdateResult ESP8266HTTPUpdate::handleUpdate(HTTPClient& http, const String&

WiFiClient * tcp = http.getStreamPtr();

WiFiUDP::stopAll();
WiFiClient::stopAllExcept(tcp);
if (_severConnectionsOnUpdate) {
WiFiUDP::stopAll();
WiFiClient::stopAllExcept(tcp);
}

delay(100);

Expand Down
8 changes: 7 additions & 1 deletion libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class ESP8266HTTPUpdate
_followRedirects = follow;
}

void severConnectionsOnUpdate(bool sever)
{
_severConnectionsOnUpdate = sever;
}

void setLedPin(int ledPin = -1, uint8_t ledOn = HIGH)
{
_ledPin = ledPin;
Expand Down Expand Up @@ -146,12 +151,13 @@ class ESP8266HTTPUpdate
// Set the error and potentially use a CB to notify the application
void _setLastError(int err) {
_lastError = err;
if (_cbError) {
if (_cbError) {
_cbError(err);
}
}
int _lastError;
bool _rebootOnUpdate = true;
bool _severConnectionsOnUpdate = true;
private:
int _httpClientTimeout;
bool _followRedirects;
Expand Down

0 comments on commit e81af05

Please sign in to comment.