1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Updater.cpp:

- use new AutoInterruptLock
 - add delay to give the RTOS some time to handle TCP

WiFiClient.cpp
 - add stopAllexcepted to cancel all TCP excepted one

ClientContext.h
 - add getLocalPort()

ESP8266HTTPUpdate.cpp
 - close all not needed TCP and UDP

osapi.h
 - missing commit from SDK
This commit is contained in:
Markus Sattler
2015-08-29 13:45:58 +02:00
parent 4ad894683e
commit 8e50cdb190
9 changed files with 78 additions and 24 deletions

View File

@ -128,10 +128,17 @@ t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port,
ret = HTTP_UPDATE_FAILD;
DEBUG_HTTP_UPDATE("[httpUpdate] FreeSketchSpace to low (%d) needed: %d\n", ESP.getFreeSketchSpace(), len);
} else {
if(ESP.updateSketch(tcp, len)) {
// may never reached!
WiFiUDP::stopAll();
WiFiClient::stopAllexcepted(&tcp);
delay(100);
if(ESP.updateSketch(tcp, len, false, false)) {
ret = HTTP_UPDATE_OK;
DEBUG_HTTP_UPDATE("[httpUpdate] Update ok\n");
tcp.stop();
ESP.restart();
} else {
ret = HTTP_UPDATE_FAILD;
DEBUG_HTTP_UPDATE("[httpUpdate] Update failed\n");

View File

@ -28,6 +28,8 @@
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <WiFiClient.h>
//#define DEBUG_HTTP_UPDATE(...) Serial1.printf( __VA_ARGS__ )