lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #51505] select and sock->rcvevent


From: Oleg Tyshev
Subject: [lwip-devel] [bug #51505] select and sock->rcvevent
Date: Wed, 19 Jul 2017 06:18:02 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0

URL:
  <http://savannah.nongnu.org/bugs/?51505>

                 Summary: select and sock->rcvevent
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: olegreen
            Submitted on: Wed 19 Jul 2017 10:18:01 AM UTC
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

select and sock->rcvevent

With receive of each data portion will be

recv_tcp() callback function called.
  API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);

API_EVENT(conn, NETCONN_EVT_RCVPLUS, len) is expanded to event_callback()
  and hier will be following code executed:
    sock->rcvevent++;

It doesn't matter how many data is received:
   NETCONN_EVT_RCVPLUS  -> sock->rcvevent++
   NETCONN_EVT_RCVMINUS -> sock->rcvevent--


The comment in lwip_selscan "/* ... then examine it: */"
say that code should be reworked

lwip_selscan() code has patch trying to fix this behaviour -
it is checked not only rcvevent, but lastdata too:
((lastdata != NULL) || (sock->rcvevent > 0))


Error scenario:
  100 times 1-byte packet recieved:
    sock->rcvevent is 100,

  recv() to receive 100 bytes called:
     100 bytes received
     sock->rcvevent is 99,

  select after that returns 99 times readset active, but socket has no data
and recv() returns EWOULDBLOCK
  It is not correct.
  After recv() sock->rcvevent should be 0





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?51505>

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




reply via email to

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