lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP retransmissions although packet has been recieved


From: address@hidden
Subject: Re: [lwip-users] TCP retransmissions although packet has been recieved
Date: Wed, 3 Oct 2018 14:20:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 03.10.2018 09:39, inderjit wrote:
Simon,

Can you please elaborate? I'm following example code from:
https://github.com/kennethnoyens/lwipHttpClient/blob/master/httpclient.c
<https://github.com/kennethnoyens/lwipHttpClient/blob/master/httpclient.c>

Well, that code is wrong, too. Why don't you take our code as example instead of (obviously broken) third party code?

Calling pbuf_free() on 'p' is enough. All chained pbufs are freed with that call.

struct pbuf is a linked list and referring to the current element at top at
that list should free only that element. That's how pbuf_free is defined (or
am i totally out of understanding?)
/**
  * Dereference a pbuf chain or queue and deallocate any no-longer-used
  * pbufs at the head of this chain or queue.
  *
  * Decrements the pbuf reference count. If it reaches zero, the pbuf is
  * deallocated.
  *
  * For a pbuf chain, this is repeated for each pbuf in the chain,
  * up to the first pbuf which has a non-zero reference count after
  * decrementing. So, when all reference counts are one, the whole
  * chain is free'd.
  *
  * @param p The pbuf (chain) to be dereferenced.
  *
  * @return the number of pbufs that were de-allocated
  * from the head of the chain.
  *
  * @note MUST NOT be called on a packet queue (Not verified to work yet).
  * @note the reference counter of a pbuf equals the number of pointers
  * that refer to the pbuf (or into the pbuf).
  *
  * @internal examples:
  *
  * Assuming existing chains a->b->c with the following reference
  * counts, calling pbuf_free(a) results in:
  *
  * 1->2->3 becomes ...1->3
  * 3->3->3 becomes 2->3->3
  * 1->1->2 becomes ......1
  * 2->1->1 becomes 1->1->1
  * 1->1->1 becomes .......
  *
  */

What's the purpose of pasting this whole comment block here?

Simon



reply via email to

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