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: Sat, 31 May 2008 17:21:07 +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

Follow-up Comment #3, bug #23240 (project lwip):

I guess what we want to achieve is consistency between the count and the
mailbox, so isn't it better to use a semaphore to ensure that either all or
none of the operations are carried out? 

As far as I can tell there are no potentially blocking calls within the
protected regions, so something like this could work:

wait recv_count_sema;
if (sys_mbox_trypost(conn->recvmbox, buf) != ERR_OK) {
netbuf_delete(buf);
signal recv_count_sema;
return;
}
else {
SYS_ARCH_INC(conn->recv_avail, p->tot_len);
API_EVENT(conn, NETCONN_EVT_RCVPLUS, p->tot_len);
signal recv_count_sema;
}

The semaphore would have to be used by all instances who access the queue and
variables, so this approach is more complex, but safer. 
These are used from netconn_recv, lwip_selscann and recv_raw.  Any other
places?

Have I missed something, or is the count kept in parallell in two places: 
recv_avail and in the form of the API_EVENT?

    _______________________________________________________

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]