lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] What can I do in a tcp_err callback?


From: address@hidden
Subject: Re: [lwip-users] What can I do in a tcp_err callback?
Date: Sun, 11 Dec 2011 16:26:13 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

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

reply via email to

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