1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

75 Commits

Author SHA1 Message Date
Max Prokhorov
204d2c93a7
NONOS SDK clean-up (#8770)
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
2023-01-03 01:40:53 +03:00
RobertGnz
3c6db4ed9b
WiFiClient::abort() (#8738)
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.
2022-12-06 12:40:48 +03:00
Max Prokhorov
7b2c627ed4
Update WiFi scan docs (#8685) 2022-10-10 18:08:06 +03:00
david gauchard
5656035bed
document side-effects for wifi-off-at-boot (#8614)
* adding wifi-off-at-boot side-effects mention in documentation
2022-06-25 23:18:54 +02:00
Chris Kitras
2de142b8db
Update RFC 5246 URL (#8564)
The old link to RFC 5246 has been moved to https://tools.ietf.org/search/rfc5246
2022-05-12 23:03:32 +02:00
Juraj Andrássy
f401f08aba
WiFiServer - 'rename' available() to accept() (#8419)
* WiFiServer - 'rename' available() to accept()
* use server.accept() instead of available()
* WiFiServer.accept() and ArduinoWiFiServer class doc update
2022-01-03 14:32:02 +01:00
aWZHY0yQH81uOYvH
f8de3fb464
ESP8266WebServer - Drop inactive connection when another is waiting to improve page load time (#8216)
* ESP8266WebServer - drop current HC_WAIT_READ connection sooner when another has data

Safari sometimes opens two connections when loading a page and only
sends a request over the second one, resulting in a 5 second wait
(HTTP_MAX_DATA_WAIT) before the request is processed. This commit
drops the current connection after 30ms (HTTP_MAX_DATA_AVAILABLE_WAIT)
when there is a new connection with data available or the buffer of
pending TCP clients is full (currently 5).
2021-10-27 22:28:47 +02:00
Earle F. Philhower, III
60fe7b4ca8
Add code-spell spelling checks to CI (#8067)
Help find and fix silly spelling errors as they are added to the repo.
2021-05-23 08:53:04 -07:00
Max Prokhorov
4436e32a50
WiFi: clean up AP SSID setter & getter, support 32 chars (#7941) 2021-05-15 12:28:22 -07:00
Max Prokhorov
b0ece8cac4
[BREAKING] wifi: remove pseudo-modes for shutdown, expose ::[resumeFrom]shutdown() (#7956)
* wifi: remove pseudo-modes for shutdown

make shutdown and resumeFromShutdown public
removes extra code from the mode handler and include method description
in the docs

* typo

* dup

* typos

* reference only shutdown() & resumeFromShutdown()

prefer to have some specific function, don't simply chain into sleep
update examples and docs

* safeguard raw sdk config usage
2021-05-15 19:49:35 +02:00
Dirk O. Kaar
cfbbd6f22d
enableWiFiAtBootTime() should be declared in ESP8266WiFi.h (#7993) 2021-04-18 22:17:14 +02:00
david gauchard
b933e3d283
WiFi off a boot: document a linker error when user wants to use wifi without including ESP8266WiFi.h (#7990) 2021-04-18 00:15:42 -07:00
david gauchard
1cc6960a55
[BREAKING] Disable WiFi at boot by default (#7902)
* Disable WiFi at boot by default

* +define WIFI_IS_OFF_AT_BOOT

* remove now useless example

* mv enableWiFiAtBootTime() to core_esp8266_features.h

* sync with master

* per @earlephilhower review: a file was missing

* doc

* WiFi persistence is now false by default

* fix doc

* ditto

* doc: remove sphinx warnings (fix links and formatting)

* fix link name

* fix doc

* legacy: restore persistence

* undeprecate preinit()

* move force modem up to when mode has changed (per @mcspr review)

* do not wake up from sleep when mode if OFF

* fix doc per review
2021-04-09 23:01:11 +02:00
Earle F. Philhower, III
7475ba7ff3
Add setSSLVersion call to SSL object (#7920)
* Add setSSLVersion call to SSL object

Allow users to only allow specific TLS versions for connections with an
additional call in their app, similar to the setCiphers call.

Fixes #7918

* Add SSL level options to WiFiServerSecure
2021-03-15 12:22:06 -07:00
ksalwin
e07542d701
Fix link to ESP8266 NonOS SDK (#7914) 2021-03-11 07:24:24 -08:00
Michael Pöttgen
bc3daef76d
WIFI_RESUME improve speed and example (#7877)
Improve resume speed by passing in last known BSSID
Provide a simpler example for WIFI_SHUTDOWN/WIFI_RESUME
Add documentation for WIFI_SHUTDOWN and WIFI_RESUME.
2021-02-15 13:51:37 -08:00
Zakary Kamal Ismail
032db6fc81
WiFiServerSecure: Cache SSL sessions (#7774)
* WiFiServerSecure: Cache the SSL sessions

* Add SSL session caching to HTTPS server examples

* Document server SSL session caching

* Fix an incomplete sentence in the documentation

* Document BearSSL::Session

* Use the number of sessions instead of the buffer size in ServerSessions' constructors
2020-12-21 21:13:43 -08:00
david gauchard
c919f61169
update documentation example (#7697) 2020-11-10 22:17:17 +01:00
Pargorn Puttapirat
eb7e082a3c
Revive a dead link (#7679)
* Revive a dead link.
* Update server-examples.rst
2020-10-27 22:06:31 -07:00
Develo
1c624dd76a
BREAKING: Add Wrong Password wifi status case (#7652)
* Add Wrong Password wifi status case
* Add wrong password case for status return
* Add wrong password case for debug
* Add Wrong password case to interactive example
* Add case for wrong password to station doc
* Add case for wrong password to resumeFromShutdown
* Add wrong password case to wifi readme
* Update ESP8266WiFiGeneric.cpp
2020-10-15 09:52:17 -07:00
Erriez
9c9e193f7f Add WiFi Multi to readme.rst 2020-10-03 17:14:25 +02:00
Earle F. Philhower, III
85ba53a249
Remove stray axtls refs, deprecated compat funcs (#7626)
Remove the axTLS compatability functions from WiFiClient/ServerSecure,
device tests for axTLS, and any document refs to axTLS.
2020-10-02 21:39:36 -07:00
standby24x7
683b8e606c
Fix spelling typos in files under doc/esp8266wifi (#7520)
This patch fixes some spelling typos in following files
bearssl-client-secure-class.rst
client-class.rst
scan-class.rst
scan-examples.rst
server-examples.rst
2020-08-12 08:28:22 -07:00
standby24x7
1134194edc
Fix spelling typos in readme.rst (#7447)
This patch fixes some spelling typos in doc/esp8266wifi/readme.rst

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2020-07-10 11:22:52 -07:00
Huldar
df9bc38bce
Grammar fixes (#7441)
Added a bunch of missing "the"s and "a"s mostly. Didn't change any of the coding examples or the meaning of this example. Great example though, thanks.
2020-07-09 20:35:19 -07:00
Earle F. Philhower, III
70e4457041
Remove axTLS from code and documentation (#7437) 2020-07-09 09:21:38 -07:00
Develo
4609e440ad
Add some pending methods to generic-class docs (#7427) 2020-07-06 16:39:30 -04:00
ChenJinBo
1bfb29395f
Update readme.rst (#7379)
ESP9266 to ESP8266
2020-06-14 23:05:42 -04:00
Earle F. Philhower, III
83166f948b
Deprecate SPIFFS, move examples to LittleFS (#7263)
* Deprecate SPIFFS, move examples to LittleFS

SPIFFS has been a great filesystem, but it has significant problems in
many cases (and it's also pretty slow).  Development seems to have
slowed/stopped on the upstream version, and we're not able to provide
support or fix the known issues with it as-is.

Deprecate SPIFFS variable.

Update all examples to use LittleFS instead of SPIFFS.

Also, minor cleanup on very old examples which has obsolete delays
waiting for the Serial port to come up, or which were stuck at 9600 baud
because of their ancient AVR heritage.

Fixes #7095

* Remove leftover debug code

* Clean up comments in some examples

* Update documentation on SPIFFS deprecation

* Fix host tests to avoid deprecation warnings

* Fix cut-n-paste error

* Restore SpeedTest.ino, adjust to allow custom FSes

Co-authored-by: Develo <deveyes@gmail.com>
2020-05-04 14:22:50 -04:00
TheMaking
1bb5ccf71e
Fixed misplacement of back quotes (#7247)
It might be the thing in some other doc files but I only noticed it here
2020-04-26 13:58:22 -04:00
david gauchard
70e8c99019
fix doc and update ci (#6692) 2019-10-31 16:55:11 +01:00
dickorydock
ea17a06bc8 Grammar edits in documentation (#6401)
* Grammar changes

* Update readme.rst

* Update README.md
2019-08-08 20:26:19 -04:00
Earle F. Philhower, III
76ed52c1b2 Update WiFiServer docs for ::write(all clients) (#6338)
Fixes #5116
Fixes #2743

The Arduino WiFiClient object allows sending the same packet to all
connected clients of a WiFiServer.  In their implementation it may make
sense, but on the 8266 with things like SSL it doesn't.

Update the docs to note that WiFiServer::write() is a no-op, and that
the app should use the WiFiCliebnt::write() on all connected clients as
appropriate.
2019-07-25 14:31:00 +02:00
Earle F. Philhower, III
c18b402c31
Add a dump of received FP and CERT when in debug mode (#6300)
* Add a dump of received FP and CERT when in debug mode

To simplify BearSSL debugging, print the received FP (when it doesn't
match the expected) and the binary certificate (always), when in debug
mode.

* Add documentation section on FP mismatch in rare instances.
2019-07-14 14:09:44 -07:00
dav1901
16312949c9 Add timeout to STA::waitForConnectResult (#5371) 2019-07-04 14:08:02 +02:00
david gauchard
1750022601
fix switching to static address with lwip2 (#6026)
fix switching to static address with lwip2

For some reason, ip address is not propagated in a visible way for lwip2
when switching to static address (wifi.config()) *after* wifi.begin().

This patch calls lwip-v1.4's netif_set_addr() with the new ip address to set
all things up, just like it is done and right when wifi.begin() is called
after wifi.config().

Also tested when IPv6 is enabled.

fix documentation: It is more natural to set an IP address before starting WiFi
(.. and not after dhcp has started)
fixes #5839
fixes #6024
2019-05-01 12:35:03 +02:00
Earle F. Philhower, III
93ef9e7005
Upgrade to https: serving for JSON, links in docs (#5992)
* Upgrade to https: serving for JSON, links in docs

Fixes #5480

* Update boards.rst documentation

* Update more documentation http: refs to https:

* Remove obsolete staging info

* Drop obsolete versions from JSON programatically

After the final merge is done on the JSON, strip out any named versions
from the final product.

Removing 1.6.5-* and 2.5.0-beta(1,2,3) for now.

* Remove 2.4.0-rc(0/1) from JSON, too
2019-04-30 23:55:03 -07:00
Earle F. Philhower, III
f6dd826437
Fix MFLN probe and allow returning whether MFLN succeeded or not after a connection. (#6000)
Fixes #5996

* Add extensions to probe message for EC, others

probeMFLN was failing on some connection attempts to servers which only
supported EC based ciphers because it did not include the proper TLS
handshake extensions to list what kinds of ECs it supported.

Add those to the probeMFLN ClientHello message to make probes pass.

* Add client.getMFLNStatus method, returns MFLN state

After a connection it is useful to check whether MFLN negotiation
succeeded.  getMFLNStatus returns a bool (valid only after
client.connect() succeeds, of course) indicating whether the requested
buffer sizes were negotiated successfully.
2019-04-25 12:40:26 -07:00
Develo
755f61b86a
Update station-class.rst (#5977)
Clarify ESP8266WiFiSTAClass::BSSID()
2019-04-12 17:09:52 -04:00
ufocia
f139519061 Correct out of bounds condition and remove an unnecessary cast (#5924)
C arrays are 0 indexed, accordingly writing to array[255] actually writes to the 256th position, which is naturally out of bounds of a 255 item array. increasing the size of the array to 256 corrects that error. Also, 0 is an int and requires a cast into a char, '\0' is just a cleaner (a more syntactically pedantic) way to achieve the same end.
2019-03-27 17:27:20 -07:00
Earle F. Philhower, III
848fbf5b4a
Update conf.py from git tag, fix sphinx warnings (#5716)
Fixes #5671

Implements https://protips.readthedocs.io/git-tag-version.html

Fix a myriad of minor Sphinx warnings generated in the docs.
2019-02-04 20:19:23 +00:00
david gauchard
b504881be4 document wificlient loop (#5355)
fix #5257
2018-11-20 17:37:21 -02:00
Develo
979e5cebd9
Update generic-class.rst (#5338)
Fix link to WiFiEvents
Add note about WiFiClients and WiFiServers going down when a WiFi interface goes down, and that it's the user's responsibility to bring them back up.
2018-11-12 22:56:20 -03:00
dav1901
79a6f36a02 Fix doc for ESP8266WiFi (#5325)
* Fix WiFiAP doc

* Fix softAP doc

* Fix doc
2018-11-08 07:06:54 -08:00
A C SREEDHAR REDDY
4726a2501a typo fix (#5319) 2018-11-07 11:13:20 -03:00
Earle F. Philhower, III
233d3e3b5e
Move BearSSLHelpers into BearSSL namespace (#5315)
BearSSLX509List, BearSSLSession, BearSSLPublicKey, and BearSSLPrivateKey
were all in the global namespace and not in the BearSSL:: one, due to an
oversight when they were originally created.  Move them to the proper
namespace with the following mapping:
    BearSSLX509List => BearSSL::X509List
    BearSSLSession => BearSSL::Session
    BearSSLPublicKey => BearSSL::PublicKey
    BearSSLPrivateKey => BearSSL::PrivateKey
2018-11-06 19:27:40 -08:00
Earle F. Philhower, III
feb86cd4ff
Add BearSSL documentation (#5311)
Document the BearSSL::WiFiClientSecure, ::WiFiServerSecure, and the
helper classes required to use them.
2018-11-06 11:45:52 -08:00
david gauchard
8ef21ca3ae Update to the last version of nonos-sdk V2, WiFi addons (#5210)
* fwupdate

* fw update to latest version:
WPA working, WEP+Open disabled by default. Need API change.

* helpers to follow sdk updates

* remove compare scripts - made a separate PR for them

* add wep api, restore original espressif comment (wep enabled does not prevent wpa)

* libmain was not up to date

* experimental: DTIM setting in WiFi.setSleepMode(WIFI_LIGHT/MODEM_SLEEP, DTIM-value)
with new getter: .getListenInterval() / .isSleepLevelMax()

* fixes

* fix debug message

* when not using listenInterval, set wifi sleep level to min

* update documentation

* update doc
2018-10-09 10:21:23 -03:00
aerlon
24a1d22730 Make softAP documentation state the correct min value (0) for the max_connection argument. (#5165) 2018-10-01 14:27:16 -03:00
daud
7643e7b05b fix doc link (#5190) 2018-10-01 02:21:46 -03:00