* Add support WiFiClientSecure TCP KeepAlive
* Make TCP keepalive and related functions virtual.
* Make TCP keepalive and related functions override.
Fixes#8939
* httpclient: use refs - httpserver: add chunks in examples
* basic https client: update cert
* debug log: read() returning -1 is usual and means "nothing to read"
* emulation on host: SSL server has never been and is now working
* style
* move SSL server certs from examples into a single place with appropriate warnings
* web-hello-servers: make chunks bigger
* factorize template declaration
* http-client: add getString(pre-reservation)
* mock: add umm_info()
* style
* comment API in example
* style
* fix per review
* Update documentation
Describe how to improve Exception Decoder results.
Updated build option details.
* Added d-a-v's code. And updated description and debug macro.
* Update doc
Updated platform.txt - positioned -Os such that it can be overridden by `build.opt`.
Add suggestion of using `-Og` which may improve the Decoder's line number correlation
with the problem in the source code.
Untested adjustments to platformio-build.py
* Fixed code formatting
* Fixed example
Previously `-O3` in the example had no effect. It was overridden by later flags.
Reording the `-Os` allowed changing optimization to work. Somehow this triggered
a new warning "Stream.h:50:7: warning: 'f.Stream::_startMillis' may be used
uninitialized in this function". Replaced `-O3` with `-Og`.
* Proposed "Debug port" menu change
Preserves a pathway for `build.opt` override.
* Update boards.txt.py and docs - WIP
* Improve organization of optimization content.
Use "Debug Optimization" for menu name.
The menu item defines the initial optimization.
platform.txt - optimization parameter can be overridden by build.opt.
* Add fallback value for build.debug_optim to platform.txt
* update text and undo changes to platformio-build.py
* tweak text
* Added ':orphan:' mark to a06-global-build-options.rst
* Update doc. Added link in page index to 'Improving Exception Decoder Results'
* Update text to reference PR#8868 improvements for leaf function.
* Upcoming EspSoftwareSerial 7.0.1
* EspSoftwareSerial example: higher bitrates due to forcing half-duplex
* Adapt to SoftwareSerial's latest use of namespace.
* In EspSoftwareSerial, some renaming after review feedback.
* EspSoftwareSerial's use of a template class in order to permit users their own GPIO capabilities definitions.
* CI caught some warning.
* Stick to non-namespace EspSoftwareSerial class name for the moment.
* Delegate operator() is now nullptr-safe, good for use in ISRs.
* Pushed EspSoftwareSerial 8.0.1: Platformio picks up versions that aren't published in Github
* re-use SdFat access mode through static const, no need to hard-code our own value w/ cast in the macro
* separate read-modes from flags; read, write and rw are distinct numbers
* simple compile-time tests in .cpp
resolve#8831
Temporarily move callback into the function scope and execute it from there.
Detaching would no longer destroy it, and re-scheduling would no longer be almost immediately cancelled by our code.
Recurrent scheduled functions will always be running in background.
esp_delay()'s interval (intvl_ms) is internally kept to its highest value allowing to honor recurrent scheduled functions requirements.
It transparently allows to keep with the arduino and nonos-sdk trivial programming way and still use background services or drivers running regularly.
The AdvancedWebServer.ino example allocated a 400 byte char array on the
stack which, in the case of the example, will work but in general is a
dangerous thing to show new users to try.
Instead, use a StreamString to generate the string on the heap.
* PHY status API for W5500 & ENC28J60 drivers
* move linkStatus() from ArduinoEthernet:: to LwipIntfDev::
* LwipIntfDev: include PHY status into ::connected()
Remove nonos-sdk-v2.2.0-28-g89920dc aka 3v0, since we have a real v3
Remove 3.0.0...3.0.4 to reduce overhead in maintaining a bunch or binary patches
Update our docs and menu opts to mention 'experimental' status
Old versions still remains in git history, so anyone wanting to play around with 3.0.x could still make use of that work
* Don't return `true` with WiFiClientSecureBearSSL::connected() when disconnected
Apply the same condition as with normal WiFiClient - we are not connected
when it's not possible to both write and read.
Implement separate methods for actual connection status and the internal
ssl engine status and update methods that were previously using available()
for this purpose
Update examples to check available() when the intent is to only read the
data and not interact with the client in any other way. Also, use connect()
as a way to notify errors, no need to check things twice
The current implementation of the Servo lib always resets the position when detaching.
In AVR Servo, this isn't the case, instead, it doesn't move the servo but leaves it as it was before getting detached.
Shortening up the default hard-coded 8000 ms timeout, will save energy when module can't reach its update server, especially on battery powered projects, and otherwise provide adaptability to the local wlan. The ESPhttpUpdate object is auto-created by #including ESP8266HTTPUpdate. ESP8266HTTPUpdate also provides a constructor with param httpClientTimeout, but to use it required destroying the auto ESPhttpUpdate object, or creating a secondESPhttpUpdate(timeout) object.
Api for saving heap when Client class is used by a Server (WiFiServer class): Client = Server.available().
Suppose the local end is the server and the remote end is the client, we will deal with heap memory at the local end.
When the local application (server) decides to close an active connection with a remote end it issues an Client.stop.
The stop() function calls the close() function of ClientContext class which in turn calls tcp_close.
The connexion is closed by tcp_close and the protocol control block (pcb) can be put in the following states depending on the requests sent by the remote: CLOSING, FIN_WAIT_1 and FIN_WAIT_2. In theses states pcbs are not freed, then consume some memory heap.
If an acknowledgment from the remote end is received, the pcb enter in TIME_WAIT state for some minutes but pcbs in TIME_WAIT state are not freed. Then consume some heap memory.
TIME_WAIT pcbs are automatically freed after some minutes or can be freed for instance issuing an tcp_kill_timewait()
in the local application which will free the oldest pcb in TIME_WAIT state.
If the connection is first closed from the remote end (the client), the local end (server) receive a connection termination request. It then acknowledge it and enter in CLOSE_WAIT state waiting for a connection termination request from the local application.
It then send a termination request and enter in LAST_ACK state until it receive an acknowledgment from the remote end.
After receiving the acknowledgment it enter in ClOSED state and the local pcb is freed leaving some room in the heap memory.
To summarize, when a connexion termination request is send by one end (remote or local), the local pcb is not freed immediatly.
This pcb can be in the following states: FIN_WAIT_1, FIN_WAIT_2, CLOSING, TIME_WAIT, CLOSE_WAIT, LAST_ACK.
As a consequence, some old pcbs from old closed connections are still consuming heap memory.
The local application can call tcp_kill_timewait hoping it will free some TIME_WAIT state pcbs. But if the server receive frequent connections requests and close them after sending whatever it has to send, there may be zero pcbs in TIME_WAIT state among all previously closed connections.
In case of insufficient memory to accept a new connection, lwip has developped a strategy: it successively tries to kill the oldest pcb in TIME_WAIT state, or in LAST_ACK state or in CLOSING state or the oldest active connection with lower priority than the new one.
As a matter of fact this "urgent" strategy is deployed only when very few heap memory remain available (less than some kb). In case of success, Client.available returns a valid Client but the local application will crash when sending or receiving data from the client (Client.read ou readuntil or available) because this need more heap memory and just some kb were freed in lwip to allocate the new pcb structure ans start the new connection.
The propose API is intended to avoid this drawback by calling the abort function of ClientContext which in turn calls tcp_abort which calls tcp_abandon. The connection is aborted and notified to the client with a RESET and the pcb and ressources associated are immediately released increasing the available heap memory.
Adds max duration check. In case it is over SDK limit, enable 'repeat'ing timer with a duration proportional to the original one and count until it executes N times, only then run the callback.
Code with durations less than that executes as usual. Original proposal was to not create anything or create some kind of error state... which seems counter-productive to not help out with this pretty solvable use-case.
Additional updates, while refactoring the class
- Stronger types for internal time management using `std::chrono::duration`. Works the same, `std::chrono::duration` handles seconds <-> milliseconds conversion, and we don't have to remember the time type in each method. (...and even allow `once()` and `attach` as overloads instead of the current `_ms`-suffix, in a future update)
- `::detach()` when timer finishes. Fixes (unintentional?) side-effect that we remain `::active()`. Plus, this destroys any lambda-bound variables that will persist with the Ticker object. And, since we can't re-arm with the existing function (`Ticker::attach_ms(uint32_t just_the_time)` and etc.)
- `std::variant` aka union for internal callback storage (kind-of similar to #6918). Instead of having two separate code paths, **always** attach our static function and dispatch using type info. Also helps with the issue described above, since it will call `std::function` dtor when ptr + arg is attached instead of doing nothing.
- smarter copy and move, detaching existing timer on assignment and detaching the moved-in timer object in both ctor and assignment. Copying or moving a running timer no longer blindly copies `_timer` pointer, allowing to disarm the original one. Since we are a simple wrapper around `os_timer_t`, just do the simpler thing (and not re-schedule the callback, try to store original times, etc. polledTimeout already does it and is copyable)
* sprinkle IPAddress(...).isSet() across our loops to avoid polling on a
stopped interface. status callback and netif_is_up **does not
guarantee and we could use the interface**!
* register *one* status callback per instance, e.g. when begin() is called
multiple times (also notice a subtle issue with schedule function when
instance is delete'ed)
* consistent LwipIntf callback signature. no need for rvalue, just pass
stdfunc as-is and let the compiler figure it out
- split workflows into separate files to trigger by path
this should help out documentation and boards / eboot / pkg files
updates, since those *wont* trigger usual build stuff anymore
- build*.sh whatever merged into just common.sh and build.sh
trigger different parity builds, mod % rem and allow to set .ino list
through the environment variable
- removes unnecessary temporary files, try to use more pipes
move remaining ones into cache dir instead of PWD
- remove legacy TRAVIS env vars, use ESP8266_ARDUINO prefix for config
- remove Windows path workarounds
- hardware/ and ide/ directories are set through envionment
do not force specific paths, simplify builds on local machine
- sketch list is set through environment. expicit paths for Windows and
macOS builders. platformio also gets a real shuffled list instead of
mod and rem magic numbers
- detect root of the repo through git cli, not base{name,dir} or relative paths
The NONOS SDK's `struct bss_info` in `user_interface.h` has grown since the
beginning of this project. The additional elements are not accessible.
Add a method for R/O access to full `struct bss_info`.
See #7965 (comment)
Amends #8507
I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.
The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)
Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.
6105635531/inc/bearssl_rsa.h (L257)
* make WiFi/Ethernet interface compatible with Arduino Ethernet API
provide some minimaly adapted examples from legacy
* move ethernet compat globals to EthernetCompat.h
* LegacyEthernet: add UDP example
* adjust comments
Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>