-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added close_abort() function to WiFiClient #2767
Closed
Closed
Commits on Dec 15, 2016
-
Added close_abort() function to WiFiClient
This branch adds a close_abort() method to the WiFiClient class. How it works, what it does: Calling `close_abort()` will close and abort the client connection it is invoked on and, as a result, free its resources (i.e. memory). **WARNING:** aborting connections without a good reason violates the TCP protocol, because a closed connection would normally need to spend some time in `TIME_WAIT` state before its resources are freed. Usage example: WiFiClient client; // set up a client { /* do things with your client */ } client.stop_abort() // when you're done,abort the // connection if you must Why it's useful: 1. Give programmers a way to shut down connections immediately if need be. The underlying `tcp.c` file has an abort function, but this has not been directly accessible via the `WiFiClient` class until now. 2. There are a number of reported issues for the repository addressing the heap corruption that can result from trying to retain too many connections in `TIME_WAIT` state (most notably: esp8266#230, esp8266#1070, esp8266#1923). Although the warning above holds, there may be circumstances where this isn't very important. For example an ESP8266 running in AP mode hosting a page, which requests a new connection every second via an AJAX script to monitor a sensor/button/etc. continusously. Currently existing alternative approach: When building a project, defining the `-D MEMP_NUM_TCP_PCB_TIME_WAIT=5`compiler directive will limit the maximum number of clients allowed to stay in TIME_WAIT state. `5` is the default, lower it as necessary. See reference [here](https://github.com/esp8266/Arduino/blob/master/tools/sdk/lwip/include/lwipopts.h#L263) Thanks: Thank you to @me-no-dev, @everslick and @Palatis for bringing the ` MEMP_NUM_TCP_PCB_TIME_WAIT` option to my attention.
Configuration menu - View commit details
-
Copy full SHA for 9fac290 - Browse repository at this point
Copy the full SHA 9fac290View commit details
Commits on Jan 8, 2020
-
Configuration menu - View commit details
-
Copy full SHA for d0b9af4 - Browse repository at this point
Copy the full SHA d0b9af4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 98c64db - Browse repository at this point
Copy the full SHA 98c64dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for dedc77e - Browse repository at this point
Copy the full SHA dedc77eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0df0005 - Browse repository at this point
Copy the full SHA 0df0005View commit details -
Configuration menu - View commit details
-
Copy full SHA for 07104a7 - Browse repository at this point
Copy the full SHA 07104a7View commit details
Commits on Jan 9, 2020
-
Configuration menu - View commit details
-
Copy full SHA for cc14048 - Browse repository at this point
Copy the full SHA cc14048View commit details
Commits on Jan 24, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 497900c - Browse repository at this point
Copy the full SHA 497900cView commit details
Commits on Nov 9, 2020
-
Configuration menu - View commit details
-
Copy full SHA for c1296ea - Browse repository at this point
Copy the full SHA c1296eaView commit details
Commits on Nov 14, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 9e9c88d - Browse repository at this point
Copy the full SHA 9e9c88dView commit details
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.