lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9143] Close partialy read buffer on socket close.


From: Yosic
Subject: [lwip-devel] [patch #9143] Close partialy read buffer on socket close.
Date: Sat, 17 Dec 2016 20:37:51 -0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0

URL:
  <http://savannah.nongnu.org/patch/?9143>

                 Summary: Close partialy read buffer on socket close.
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: yosic
            Submitted on: Sun 16 Oct 2016 10:17:16 PM GMT
                Category: sockets/netconn
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

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.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 16 Oct 2016 10:17:16 PM GMT  Name: close partialy read buffer on
socket close(sockets API).diff  Size: 649B   By: yosic

<http://savannah.nongnu.org/patch/download.php?file_id=38741>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9143>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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