lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] slip recvs corrupted packets (Was Re: tcp_connect is ab


From: Chris Frost
Subject: Re: [lwip-users] slip recvs corrupted packets (Was Re: tcp_connect is aborted)
Date: Wed, 15 Dec 2004 06:09:40 -0800
User-agent: Mutt/1.3.28i

On Wed, Dec 15, 2004 at 12:15:01PM +0100, address@hidden wrote:
> I'm unfamliar with this code, but if it is true what you say
> "slipf_loop() appears to be designed for  multithread programs"
> then this might be the culprit.

Ok, here are some more details on what I've done in this respect.

lwip's slipif_loop() does this:
  while (1) {
    p = slipif_input(netif);
    netif->input(p, netif);
  }

My new slipif_loop_iter() that is called once per main-loop does this:
        p = slipif_input(nif);
        if(p != NULL)
                nif->input(p, nif);


I've modified slipif_input() to return NULL when there was no data to read.
The change:

  while (1) {
          c = sio_recv(netif->state);

+         // Jump out if no buffered data
+         if(*(int*)(netif->state) == 0)
+                 return NULL;

          switch (c) {
                  case SLIP_END:

sio_fd_t netif->state is an int*. sio_recv() sets the value this points to, to
0 when no data was read. *(int*)(netif->state) != 0 when sio_recv() found
data to read and return.

I've also modified slipif_init() to not create the slipif_loop thread,
this line is commented out.

In my last post I didn't mention this, but for the sake of completeness,
I thought it might be good to: For my tests I'm pinging my lwip host.
After a number of packets have been received (maybe 5s of pinging), I get
this debug output evermore:

slipif_input: alloc
pbuf_alloc(length=128)
pbuf_alloc: allocated pbuf 0x0
slipif_input: no new pbuf! (DROP)

Even when I stop pinging the lwip host, these four lines continue to be
repeated.
Are pbufs not being released when they should be?
Perhaps this is just an effect of the corrupted packets, but I wanted to
mention it in case it might shed some light.


thanks again everyone,
-- 
Chris Frost  |  <http://www.frostnet.net/chris/>
-------------+----------------------------------
Public PGP Key:
   Email address@hidden with the subject "retrieve pgp key"
   or visit <http://www.frostnet.net/chris/about/pgp_key.phtml>




reply via email to

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