lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #23240] recv_udp increases counters for available rece


From: Steinar Lieng Fredriksen
Subject: [lwip-devel] [bug #23240] recv_udp increases counters for available receives before netbuf is actually posted
Date: Tue, 13 May 2008 10:51:11 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

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

                 Summary: recv_udp increases counters for available receives
before netbuf is actually posted
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: steinarlf
            Submitted on: Tuesday 05/13/2008 at 10:51
                Category: UDP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 

    _______________________________________________________

Details:

If the trypost fails the counters are not decreased, leading to potential
errors later. I had lwip_recvfrom block even though it was set to nonblocking
mode. 

I don't know if delaying the actual increase of the counters affect anything.
This is done in the context of the tcpip thread, but might affect the raw
api?

api_msg.c, line 169-175:
  SYS_ARCH_INC(conn->recv_avail, p->tot_len);
  /* Register event with callback */
  API_EVENT(conn, NETCONN_EVT_RCVPLUS, p->tot_len);
  if (sys_mbox_trypost(conn->recvmbox, buf) != ERR_OK) {
    netbuf_delete(buf);
    return;
  }

Proposed fix:
  if (sys_mbox_trypost(conn->recvmbox, buf) != ERR_OK) {  
    LWIP_DEBUGF(NETBUFERR,("recv_udp !!! TRYPOST FAILED\n"));
    netbuf_delete(buf);
    return;
  }
  else {
    SYS_ARCH_INC(conn->recv_avail, p->tot_len);
    /* Register event with callback */
    API_EVENT(conn, NETCONN_EVT_RCVPLUS, p->tot_len);  
  }




    _______________________________________________________

Reply to this item at:

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

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





reply via email to

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