lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] TCP causing out of mem pool [RAW]


From: Chris_S
Subject: Re: [lwip-users] TCP causing out of mem pool [RAW]
Date: Wed, 29 Jul 2009 03:40:04 -0700

> > > Still looks like the lwIP side is not closing its end of the
> > > connections.  There are no FIN packets coming from 192.168.2.1.  Most
> > > likely this is due to the stack waiting for the application to call
> > > tcp_close().

Well I'm confused now.  I checked this out, and tcp_close() is being called.
I put a breakpoint on that routine and it gets tripped twice, once for the
HTML and the other for the GIF.  That seems correct.

The console output below shows the debug strs from my HTTPd.  You can see
the "Closing Connection" str itself.  The actual code for close_conn() is
shown also below.

I tried both versions of close_conn below, the 2nd one is from the contrib
section.  It doesn't produce a FIN either.  But it does create a mem_malloc
error msg that the other close_conn() routine does not.

I agree FIN is not showing up in the Wireshark trace, yet tcp_close() is
being called.

So what does that mean?  What else controls FIN being sent?

Thanks, Chris.

==================

CON>:::::::::::::
CON>Console Start
CON>:::::::::::::
CON>Starting lwIP, StaticIP 192.168.2.1
CON>udp_bind(ipaddr = CON>, port = 137)
CON>HTTP Server Started
CON>ASSERT: Assert Test
CON>ASSERT: Error Test
CON>http_accept 0x400072f4
CON>http_recv 0x400072f4
CON>Request:
GET / HTTP/1.1
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Avant
Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
CON>Looking for /index.shtml...
CON>Looking for /index.ssi...
CON>Looking for /index.shtm...
CON>Looking for /index.html...
CON>Opened.
CON>Sending 1637 bytes
CON>tcp_output
CON>send_data end.
CON>http_sent 0x400072f4
CON>Trying to read 2920 bytes.
CON>End of file.
CON>Closing connection 0x400072f4
CON>http_sent 0x400072f4
CON>http_accept 0x40007220
CON>http_recv 0x40007220
CON>Request:
GET /img/sics.gif HTTP/1.1
Accept: */*
Referer: http://192.168.2.1/
Accept-Language: en-us
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Avant Browse
CON>Opening /img/sics.gif
CON>Sending 823 bytes
CON>tcp_output
CON>send_data end.
CON>http_sent 0x40007220
CON>Trying to read 2920 bytes.
CON>End of file.
CON>Closing connection 0x40007220
CON>http_sent 0x40007220


=======

static void close_conn(struct tcp_pcb *pcb, struct http_state *hs) {
  err_t err;
  DEBUG_PRINT("Closing connection 0x%08x\n", pcb);

  tcp_arg(pcb, NULL);
  tcp_sent(pcb, NULL);
  tcp_recv(pcb, NULL);
  if(hs) {
    if(hs->handle) {
      fs_close(hs->handle);
      hs->handle = NULL;
      }
    if(hs->buf) {
      mem_free(hs->buf);
      }
    mem_free(hs);
  }
  err = tcp_close(pcb);
  if(err != ERR_OK) {
      DEBUG_PRINT("Error %d closing 0x%08x\n", err, pcb);
      }
}

=========
(This is the standard one from contrib)

static void close_conn(struct tcp_pcb *pcb, struct http_state *hs) {
  tcp_arg(pcb, NULL);
  tcp_sent(pcb, NULL);
  tcp_recv(pcb, NULL);
  mem_free(hs);
  tcp_close(pcb);
}

Attachment: lx700_1.pcap
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]