patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9143, Close partialy read buffer on...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9143: Close partialy read buffer on socket close.

Submitter:  Yosic <yosic>
Submitted:  Sun 16 Oct 2016 10:17:16 PM UTC
   
 
Category:  sockets/netconn Priority:  5 - Normal
Status:  Invalid Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Planned Release:  None

Mon 17 Oct 2016 07:28:14 AM UTC, comment #1: 

Please disregard and close.
I found that the functionality is already implemented inside socket_free() and moreover my patch is incorrect.

Yosic <yosic>
Sun 16 Oct 2016 10:17:16 PM UTC, original submission:  

lwip_close() has an assert against sock->lastdata == NULL.
It is neither useful nor logically correct because of two things.
1. End user is required to read the whole packet to the end or not starting to read it at all to avoid memory leak(pbuf is not freed in this case). Moreover user can't even know if he's read the whole packet if data flow to the socket is quite heavy.
2. Asserts are not always enabled and this condition can be hidden from the user.

If packet reading is not started pbuf is correctly freed inside netconn_drain() but it is not the case when pbuf was taken out from recv msg queue and assigned to sock->lastdata.

The patches changes the behavior. lwip_close() checks sock->lastdata and frees pbuf if necessary.

Yosic <yosic>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Updated the item)
  • -email is unavailable- added by yosic (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-17 dziegel StatusNone Invalid
        Open/ClosedOpen Closed
    2016-10-16 yosic Attached File- Added close partialy read buffer on socket close(sockets API).diff, #38741

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code