Working around a stupid error in the esp code... mostly... I hope.

pull/30/head
Jeroen Domburg 10 years ago
parent c0dc815574
commit e971868f21
  1. 6
      user/httpd.c

@ -395,7 +395,11 @@ static void ICACHE_FLASH_ATTR httpdDisconCb(void *arg) {
int i; int i;
for (i=0; i<MAX_CONN; i++) { for (i=0; i<MAX_CONN; i++) {
if (connData[i].conn!=NULL) { if (connData[i].conn!=NULL) {
if (connData[i].conn->state==ESPCONN_NONE || connData[i].conn->state==ESPCONN_CLOSE) { //Why the >=ESPCONN_CLOSE and not ==? Well, seems the stack sometimes de-allocates
//espconns under our noses, especially when connections are interrupted. The memory
//is then used for something else, and we can use that to capture *most* of the
//disconnect cases.
if (connData[i].conn->state==ESPCONN_NONE || connData[i].conn->state>=ESPCONN_CLOSE) {
connData[i].conn=NULL; connData[i].conn=NULL;
if (connData[i].cgi!=NULL) connData[i].cgi(&connData[i]); //flush cgi data if (connData[i].cgi!=NULL) connData[i].cgi(&connData[i]); //flush cgi data
httpdRetireConn(&connData[i]); httpdRetireConn(&connData[i]);

Loading…
Cancel
Save