If write buffering is enabled, then it is necessary to release the write buffer resources (callback structure) when the socket is closed

This commit is contained in:
Gregory Nutt 2014-01-14 18:19:43 -06:00
parent 806af1f4e2
commit 2bfad60c85
2 changed files with 20 additions and 5 deletions

View File

@ -6436,6 +6436,9 @@
in the PX4 GIT repository.
* fs/fat/fs_fat32.c: A correction to FAT cluster allocation from
Tridge via Lorenz Meier (2014-1-14).
* net/net_clone.c: Need to clone fields for TCP write buffering
as well (2014-1-14).
* net/net_clone.c: If CONFIG_NET_TCP_WRITE_BUFFERS is selected,
then the socket-related write buffering information must copied
with the other cloned socket data (2014-1-14).
* net/net_close.c: If CONFIG_NET_TCP_WRITE_BUFFERS is selected,
then it is necessary to free the write buffere callback structure
when the socket is closed (2014-1-14).

View File

@ -285,9 +285,21 @@ static inline int netclose_disconnect(FAR struct socket *psock)
flags = uip_lock();
conn = (struct uip_conn*)psock->s_conn;
/* There shouldn't be any callbacks registered */
/* If we have a semi-permanent write buffer callback in place, then
* release it now.
*/
DEBUGASSERT(conn->list == NULL);
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
if (psock->s_sndcb)
{
uip_tcpcallbackfree(conn, psock->s_sndcb);
psock->s_sndcb = NULL;
}
#endif
/* There shouldn't be any callbacks registered. */
DEBUGASSERT(conn && conn->list == NULL);
/* Check for the case where the host beat us and disconnected first */