About two years ago I wrote a generalized HTTP server for the ESP8266 (specifically the WeMos D1 Mini) using your Non-OS SDK via the Arduino IDE. At that time it was working fine. It would run for days/weeks processing requests with hundreds of browsers banging on it. No memory leaks, or squeaks. Fast forward to today – I loaded up my old project in an Arduino environment with the latest Arduino IDE 1.8.10 and the ESP8266 Community version 2.5.2. Refreshing a browser pointed to a hosted web page a couple of times exhausts the 5 connections permitted on the ESP8266 and then it basically stops processing requests.
Working backwards through the old libraries 2.5.1, 2.5.0, 2.4.2… etc, I finally loaded up 2.3.0 and it works as I recall. The issue seems to be the ESP8266 espconn_disconnect() method is no longer cleaning up the connection and firing my espconn_regist_disconcb disconnect callback event.
I am assuming I am missing some new procedure. I have done many Google searches on this site as well as the Internet at large for both of the methods above as well as changes in the libraries between 2.3.0 and 2.4.0. I’m not having any luck.
Any help would be appreciated. Thanks.
Here are the espconn steps I’m doing in code that work for the old 2.3.0 library.
1. I have a C++ object representing this one client browser connection.
2. When a new browser connection is requested, the espconn_regist_connectcb callback is fired and it is forwarded to one of these objects. In it I…
a. Store a reference to the supplied espconn*
b. Set the espconn->reserve to this object
c. Set the espconn_regist_recvcb, espconn_regist_sentcb, and espconn_regist_disconcb callbacks
d. Set the espconn_set_opt
3. The espconn_regist_recvcb eventually gets called and I read the incoming browser request and set the C++ object to process the request in the next Arduino loop cycle. I do not do the actual processing in the callback.
4. The next loop reads and outputs the requested SPIFF file. Depending on size of the file, this is handled over multiple loop cycles so that minimal time is used.
5. The file is closed and espconn_disconnect method is called.
6. In the 2.3.0 library, the espconn_regist_disconcb event is called consistently 1 ms later. In any of the more recent libraries (2.4.0 – 2.5.2) I never receive the [b]espconn_regist_disconcb[/b] callback.
Who is online
Users browsing this forum: Baidu [Spider] and 6 guests
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
We also have a RTOS version and a MESH version too!
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!