2009/7/29 JM <[email protected]>:
>     while(data > 0)
>     {
>         data = data - (int)current_pbuf->len;
>         tcp_recved(pcb, current_pbuf->len);
>         next_pbuf = current_pbuf->next;
>         pbuf_free(current_pbuf);
>         current_pbuf = next_pbuf;
>     }

There is no need to walk the pbuf chain, pbuf_free() does that for
you. Calling tcp_recved() many times doesn't look right: that will
cause many redundant receive window update packets from lwip. Just
call it once with buf->tot_len.

err_t newdata(void *arg, struct tcp_pcb *pcb, struct pbuf *buf, err_t err)
{
    tcp_recved(pcb, buf->tot_len);
    pbuf_free(buf);
    return ERR_OK;
}


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to