[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #51505] select and sock->rcvevent
From: |
Joel Cunningham |
Subject: |
[lwip-devel] [bug #51505] select and sock->rcvevent |
Date: |
Wed, 19 Jul 2017 10:08:48 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4 |
Follow-up Comment #1, bug #51505 (project lwip):
Did you find an issue through testing or was this looking at the code?
The rcvevent is not a byte counter but instead is incremented/decremented for
each pbuf stored in the netconn's recvmbox.
> lwip_selscan() code has patch trying to fix this behaviour -
> it is checked not only rcvevent, but lastdata too:
> ((lastdata != NULL) || (sock->rcvevent > 0))
lastdata is used to track a pbuf that was received from the netconn layer but
not fully consumed by the caller of recv(). So if the last pbuf from recvmbox
is only partially read, rcvevent will be at 0, but lastdata will be non-NULL
and select should return the socket as readable.
> recv() to receive 100 bytes called:
> 100 bytes received
> sock->rcvevent is 99,
I think this part is incorrect. Each 1-byte pbuf will be received by the
socket layer from the netconn recvmbox via netconn_recv_data(). When that
happens, API_EVENT(conn, NETCONN_EVT_RCVMINUS, len); is called for each 1 byte
pbuf
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?51505>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/