mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
unref udp if exists
This commit is contained in:
parent
b485a6c9b3
commit
fe9dc913b4
@ -34,6 +34,13 @@ ArduinoOTAClass::ArduinoOTAClass()
|
||||
{
|
||||
}
|
||||
|
||||
ArduinoOTAClass::~ArduinoOTAClass(){
|
||||
if(_udp_ota){
|
||||
_udp_ota->unref();
|
||||
_udp_ota = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ArduinoOTAClass::onStart(OTA_CALLBACK(fn)) {
|
||||
_start_callback = fn;
|
||||
}
|
||||
@ -50,9 +57,6 @@ void ArduinoOTAClass::onError(OTA_CALLBACK_ERROR(fn)) {
|
||||
_error_callback = fn;
|
||||
}
|
||||
|
||||
ArduinoOTAClass::~ArduinoOTAClass() {
|
||||
}
|
||||
|
||||
void ArduinoOTAClass::setPort(uint16_t port) {
|
||||
if (!_initialized && !_port && port) {
|
||||
_port = port;
|
||||
@ -84,6 +88,11 @@ void ArduinoOTAClass::begin() {
|
||||
_port = 8266;
|
||||
}
|
||||
|
||||
if(_udp_ota){
|
||||
_udp_ota->unref();
|
||||
_udp_ota = 0;
|
||||
}
|
||||
|
||||
_udp_ota = new UdpContext;
|
||||
_udp_ota->ref();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user