I'm using lwIP 1.4.1 and httpserver_raw with nothing else, just trying to get the stack to function reliably. I created a test webpage, slightly more complex than the included sample at not quite 4kb in size.
In the tcp_receive() function the pcb->snd_queuelen at a particular point of serving up the webpage is equal to four. But after this line:
pcb->snd_queuelen -= pbuf_clen(next->p);
it's way over 60000. The pbuf_clen() function is returning the value I have for MEMP_NUM_PBUF. It was 32, so the function returns 32 and decrements pcb->snd_queuelen by 32, which is already at only 4. Ooops.
So I changed MEMP_NUM_PBUF to 16 and then pbuf_clen() returns 16, which again makes pcb->snd_queuelen roll over to essentially a negative number.
I doubt there's a bug in lwIP because I've used this same version on a different microcontroller and it works great. Any insight into what I could be doing wrong would be great. I'm not sure where to go from here.