On 11 December 2011 23:26, [email protected] <[email protected]> wrote:
> narke wrote:
>
> After checking the 1.4.0 source code, I found it seems that doing any
> operation on a pcb in its tcp_err callback function is not safe.
> Since when lwip was invoking the error callbackup, the pcb either had
> been freed or will being freed shortly.
>
> In particularly,  can someone confirm what's the consequences if I
> call following function in a tcp_err callback:
>
> - tcp_close( the current pcb )
> - tcp_new()
>
>
> Please do read the documentation. In rawapi.txt, it says:
> "The error callback function does not get the pcb passed to it as a
> parameter since the pcb may already have been deallocated."
>
> Consequently, there is no "current pcb" inside the error callback, as the
> old "current" pcb already has been deallocated. You can of course allocate a
> new pcb (with tcp_new()) unless you are already out of pcb structs.
>
> Simon
>

Simon,

It's clear. Thanks.  Sorry for don't read the document when I had the question.


-- 
Life is the only flaw in an otherwise perfect nonexistence
    -- Schopenhauer

narke
public key at http://subkeys.pgp.net:11371 ([email protected])

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

Reply via email to