lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Usage of TCP_EVENT_RECV macro


From: Leon Woestenberg
Subject: Re: [lwip-users] Usage of TCP_EVENT_RECV macro
Date: Mon, 06 Sep 2004 21:10:07 +0200
User-agent: Mozilla Thunderbird 0.7.1 (Windows/20040626)

Hello Roland, Lee,

Roland Winistörfer wrote:

Hi

After a few little problems I got the lwIP (version 1.0) with uC/OS working on my hardware. But there is a little curiosity, if a try to show the little HTML page over the lwIP.

I often break into the "LWIP_ASSERT("p != NULL", p != NULL);" at the beginning of the pbuf_free(). This is called from the tcp_input() with the following code:

   /* If a FIN segment was received, we call the callback
       function with a NULL buffer to indicate EOF. */
       if (recv_flags & TF_GOT_FIN) {
           TCP_EVENT_RECV(pcb, NULL, ERR_OK, err);
       }

The call of the pbuf_free() is hidden in the TCP_EVENT_RECV macro. But if I have look into this macro, there is an else case with a call of pbuf_free(NULL) (in fact the "p" argument of the macro TCP_EVENT_RECV is always NULL), which always results in the assert condition above.

What's going wrong here ? Is this macro misplaced here (means the else case) ?

For any packet p, the macro first looks if the recv() callback is non-NULL and passes the packet, otherwise drops (simply frees) the given packet p.

In this case, TCP_EVENT_RECV() is called with a NULL packet p to indicate EOF to the callback function.

**The real problem seems to be that the callback function is not installed, i.e. pcb->recv == NULL**

However, the macro should not try to free a NULL packet and shouldn't. I will fix this in CVS.

Regards, Leon.





reply via email to

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