Jikai Ye wrote:
I'm looking at version 1.3.1
In rawapi.txt it is mentioned that
If a connection is aborted because of an error, the application
is alerted of this event by the err callback. Errors that might abort
a connection are when there is a shortage of memory. The
callback function to be called is set using the tcp_err()
function.
although in the tcp_abandon() function (tcp_abort is just a
wrapper macro for this),
there is a branch indicates that if this
connection is at TIME_WAIT, the TCP_EVENT_ERR is not called. An application
may depend on the tcp_err to de-allocate application specific resources, like
buffers. If an tcp_abort() is called while at TIME_WAIT, does that mean the
resources won't be de-allocated? Would that result in memory leakage?
The important point is that the TIME_WAIT
state occurs after the connection has been closed at the local end. It is a
delay during which any further packets received for that connection are
discarded (usually with a FIN/ACK response to the peer, as it may have missed
the FIN or ACK response to FIN).
Since the connection has already been closed
locally, the application has already been notified about the close and will have
released any resources. Any attempt to abort a closed connection
should not issue any callbacks to the application, as it no longer has any
knowledge of that connection.
|