Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, While using this library to download an ota binary from GitHub instead of the Arduino server in the example I encountered a bug in row 185 of src/Arduino_ESP32_OTA.cpp: _client->read(_ota_header.buf, sizeof(OtaHeader));
In 90% of the tests I did _client->available() returned 0 at the point in time of execution of row 185. The call to this function do not wait for more data to be received, hence the download failed. This did not happen for the Arduino server. I have implemented a solution similar to what is used in lzss_download() which uses the same time out value to fix this.
Also I added a new example downloading bin files form this GitHub repo since I imagine this server would be the go to for most users. Since the bin files does not exist on master yet the example will not work until merged. If you want to test you should be able to use a link to my fork instead:
https://raw.githubusercontent.com/sverreknutsen/Arduino_ESP32_OTA/ota_bin_recieve_bug/examples/LOLIN_32_Blink/LOLIN_32_Blink.ino.ota
I hope this is helpful. Feel free to do what you want with this pull request.