File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ ArduinoOTAClass::ArduinoOTAClass()
3434{
3535}
3636
37+ ArduinoOTAClass::~ArduinoOTAClass (){
38+ if (_udp_ota){
39+ _udp_ota->unref ();
40+ _udp_ota = 0 ;
41+ }
42+ }
43+
3744void ArduinoOTAClass::onStart (OTA_CALLBACK(fn)) {
3845 _start_callback = fn;
3946}
@@ -50,9 +57,6 @@ void ArduinoOTAClass::onError(OTA_CALLBACK_ERROR(fn)) {
5057 _error_callback = fn;
5158}
5259
53- ArduinoOTAClass::~ArduinoOTAClass () {
54- }
55-
5660void ArduinoOTAClass::setPort (uint16_t port) {
5761 if (!_initialized && !_port && port) {
5862 _port = port;
@@ -84,6 +88,11 @@ void ArduinoOTAClass::begin() {
8488 _port = 8266 ;
8589 }
8690
91+ if (_udp_ota){
92+ _udp_ota->unref ();
93+ _udp_ota = 0 ;
94+ }
95+
8796 _udp_ota = new UdpContext;
8897 _udp_ota->ref ();
8998
You can’t perform that action at this time.
0 commit comments