-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Blynk library version: master branch at 144a90f
IDE: VS Code + PlatformIO
IDE version: 1.52.1
Board type: ESP8266
Additional modules: Arduino ESP8266
Scenario, steps to reproduce
Blynk.run()
blocks if there is no internet connection on the network and connecting to a local server via SSL.
According to my investigation, BlynkArduinoClientSecure::connect()
enters into an infinite loop if it can't obtain the current time via NTP:
if (now < 100000) {
// Synchronize time useing SNTP. This is necessary to verify that
// the TLS certificates offered by the server are currently valid.
configTime(0, 0, "pool.ntp.org", "time.nist.gov");
while (now < 100000) {
delay(100);
now = time(nullptr);
}
}
If there is no answer for the NTP request, the inner while
loop doesn't finish. Since Blynk is not the only application that must be executed in the Arduino loop()
, this bug renders my device unusable.
Place of call in my application: https://github.com/tomikaa87/esp-iot-base/blob/bc40f1b2310e56407f1013bfcc85dd5c5c7118cb/src/CoreApplication.cpp#L163 (BlynkHandler::task()
calls Blynk.run()
directly)
Expected Result
Blynk.run()
doesn't block if the Internet is not reachable, leaving the SSL socket disconnected until the time is properly set and the verification can be done.
Actual Result
Blynk.run()
doesn't return if the NTP server baked into BlynkArduinoClientSecure
is not reachable.