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

replace new by new (std::nothrow), remove arduino_new

This commit is contained in:
david gauchard
2020-08-17 18:15:45 +02:00
parent 5b3d290de8
commit 6925982284
45 changed files with 207 additions and 167 deletions

View File

@ -106,7 +106,7 @@ void ArduinoOTAClass::setRebootOnSuccess(bool reboot){
_rebootOnSuccess = reboot;
}
void ArduinoOTAClass::begin(bool useMDNS) {
bool ArduinoOTAClass::begin(bool useMDNS) {
if (_initialized)
return;
@ -126,11 +126,13 @@ void ArduinoOTAClass::begin(bool useMDNS) {
_udp_ota = 0;
}
_udp_ota = new UdpContext;
_udp_ota = new (std::nothrow) UdpContext;
if (_udp_ota == nullptr)
return false;
_udp_ota->ref();
if(!_udp_ota->listen(IP_ADDR_ANY, _port))
return;
return false;
_udp_ota->onRx(std::bind(&ArduinoOTAClass::_onRx, this));
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_MDNS)
@ -149,6 +151,7 @@ void ArduinoOTAClass::begin(bool useMDNS) {
#ifdef OTA_DEBUG
OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port);
#endif
return true;
}
int ArduinoOTAClass::parseInt(){