-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Async ota #1056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async ota #1056
Conversation
pull master
pull master
still up to the user to call ArduinoOTA.handle() to start the upload
@@ -70,7 +84,12 @@ void ArduinoOTAClass::begin() { | |||
_port = 8266; | |||
} | |||
|
|||
_udp_ota.begin(_port); | |||
_udp_ota = new UdpContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to check that _udp_ota
is nullptr before creating another one. If it isn't, unref
it first. This could happen if someone calls begin() twice for some reason.
Also destructor is missing... Add it along with if (_udp_ota) _udp_ota->unref();
. I know that ArduinoOTA is a static object now, but it's omission makes any c++ programmer weep :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a destructor :) it's empty though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right. Lost it among other one-liners.
still up to the user to call ArduinoOTA.handle() to start the upload