-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Allow shutting down of TcpServers #1284
Conversation
Have to be improved to free all RAM (heap) taken when HTTP server is created.
Force-close all connections.
2b78200
to
603d268
Compare
@bbourdel Can you check if this PR is working for you? The way to shutdown the server is to call |
@slaff Tested and OK !! :-) |
Fixes segfault with HttpServer::shutdown();
a6338c5
to
09ee2b4
Compare
totalConnections = connections.count(); | ||
if(totalConnections == 0 && !active){ | ||
debugf("Shutting down the Http Server"); | ||
delete this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to myself: That will cause a race condition - HttpServer will start freeing the resources and meanwhile the HttpServerConnections will try to use those resource in their destructors... A timer with 3 - 4 seconds delay should fix this...
The shutdown uses timeouts to "gracefully" close the client connections.
It should be possible to shut down cleanly all servers that inherit from TcpServer.
decbf7c
to
26ed098
Compare
* commit 'f8f675415c36dd4d8da45cfc3669f50469c65d8d': Preparation for release 3.5.0. (SmingHub#1295) Added Stream::indexOf(char c) that finds a character in a stream (SmingHub#1290) Made spiffs_mount() compatible with rBoot. (SmingHub#1292) Added experimental support for SDK 2.1 (SmingHub#1264) Initial test code for improved sendPing and sendPong. (SmingHub#1270) Added experimental support for LWIP v2 (SmingHub#1289) Fixed ssl memory leaks related to SSL context not being freed (SmingHub#1288) Fixed an error breaking SSL session resumption, Http Connection reuse and Http pipelining. (SmingHub#1287) Added Adafruit_BME280 Library (SmingHub#1286) Allow immediate server deletion if there are no active connections. (SmingHub#1285) Deleting an HttpClient should result in freeing the total memory it uses. Allow shutting down of TcpServers (SmingHub#1284) TcpConnection fixes related to ssl extensions. Styling fixes for HttpClient. fix/MemoryLeak(Heap) during TCP Client connection and delete Reverted: m_printf: stacksize reduced SmingHub#1097. (SmingHub#1279) Preparation for release 3.4.0. (SmingHub#1277) Mqtt memory fix: Fix copy and paste error (SmingHub#1276) Fix Memory Leak in Mqtt (SmingHub#1273) Changed a TcpClient message to be less confusing. (SmingHub#1271)
* commit '4a0fec18235521e4369d111f111c2624fbd3203b': (50 commits) Added the Arduino Libraries. Added the latest changes to the third-party projects. Preparation for release 3.5.0. (SmingHub#1295) Added Stream::indexOf(char c) that finds a character in a stream (SmingHub#1290) Made spiffs_mount() compatible with rBoot. (SmingHub#1292) Added experimental support for SDK 2.1 (SmingHub#1264) Initial test code for improved sendPing and sendPong. (SmingHub#1270) Added experimental support for LWIP v2 (SmingHub#1289) Fixed ssl memory leaks related to SSL context not being freed (SmingHub#1288) Fixed an error breaking SSL session resumption, Http Connection reuse and Http pipelining. (SmingHub#1287) Added Adafruit_BME280 Library (SmingHub#1286) Allow immediate server deletion if there are no active connections. (SmingHub#1285) Deleting an HttpClient should result in freeing the total memory it uses. Allow shutting down of TcpServers (SmingHub#1284) TcpConnection fixes related to ssl extensions. Styling fixes for HttpClient. fix/MemoryLeak(Heap) during TCP Client connection and delete Reverted: m_printf: stacksize reduced SmingHub#1097. (SmingHub#1279) Preparation for release 3.4.0. (SmingHub#1277) Mqtt memory fix: Fix copy and paste error (SmingHub#1276) Fix Memory Leak in Mqtt (SmingHub#1273) ...
Rebase of #1280.