Summary
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.
More Details
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.
After 2.3.0, espconn_regist_disconcb callback doesn't fire after I call espconn_disconnect
-
- Posts: 22
- Joined: Thu Dec 14, 2017 10:53 am
- Contact:
After 2.3.0, espconn_regist_disconcb callback doesn't fire after I call espconn_disconnect
Postby Inquisitor » Fri Sep 27, 2019 10:09 am
3 lines of code = App/Web Server w/ GUI Admin, File Mngr, OTA, AP Mgr, Perf Metrics, WebSocket Comms, App API, All running on ESP8266... Even usable on ESP-01S
https://www.esp8266.com/viewtopic.php?f=11&t=23535
https://InqOnThat.com
https://www.esp8266.com/viewtopic.php?f=11&t=23535
https://InqOnThat.com
Who is online
Users browsing this forum: No registered users and 268 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.