Blynk.connect(timeout), timeout not working correct

blynk.connect(timeout), timeout not working correct in 0.4.8 … in 0.4.7 is OK

I find where is the problem, is in file BlynkProtocol.h:

bool connect(uint32_t timeout = BLYNK_TIMEOUT_MS*3) {
    conn.disconnect();
    state = CONNECTING;
    millis_time_t started = this->getMillis();
    while ((state != CONNECTED) &&
           (this->getMillis() - started < timeout))
    {
        run();
    }
    run(); // Workaround for #325: Getting wrong bytes with ESP8266-SSL
    return state == CONNECTED;
}

I comented second run() … now is Ok.

@vshymanskyy could you please have a look?

1 Like

Seeing the smet ytpe of issues.

No timeout working correctly.

while ((state != CONNECTED) &&
       (this->getMillis() - started < timeout))
{
    run();
}

**run();**

it try to connect 2 times to server … in case your server is down … timeout = user_timeout + default_timeout >>> if user_timeout = 5 sec && default_timeout = 10 sec >> final_timeout = 15 sec != 5 sec (user defined) …

same bug report: [SOLVED] Blynk v0.4.8 resets Wemos D1 mini hardware on reconnection to Blynk.connect()