lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Problem with recv_udp and NETCONN_EVT_RCVPLUS


From: Hans . Forsstrom
Subject: [lwip-devel] Problem with recv_udp and NETCONN_EVT_RCVPLUS
Date: Mon, 30 Mar 2009 13:42:09 +0200


Hello,
I'm using lwIP version 1.3.0 with UDP and the netconn API. The connection is created with netconn_new_with_proto_and_callback() and I have some problems with the callbacks. I run a test where I send 1000 UDP pakets with 160 bytes of data to the connection, and during this tests I noticed a problem. I get more callbacks with NETCONN_EVT_RCVPLUS then what I can read from the connection, and that result in my thread blocking on the recv method at the end. This might not have been a real issue if my task wasn't supervised and are required to respont to a heartbeat at regular intervals.

I have done some simple debugging and the problem seems to be in api_msg.c:

static void recv_udp(...)
{
......

// The last lines in the method.
  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;
  }
}


The problem is that if the sys_mbox_trypost() calls fails, then the callback will still be executed but the data is deleted in the if statement. The implementation of the mbox doesn't have a queue, but even if it had one the problem could still arise. The solution I tested was to move SYS_ARCH_INC() and API_EVENT() below the if satement, and that seems to work better.

I don't know if the change I made will break something else, so I thought I should raise the issue to this maillinglist instead.

Any comments on this?

Best Regards,
Hans
******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an 
electronic signature and/or legally binding agreement in the absence of an
express statement or Autoliv policy and/or procedure to the contrary.
This E-mail and any attachments hereto are Autoliv property and may contain legally
privileged, confidential and/or proprietary information.
The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way
disseminating any material contained within this E-mail without prior written
permission from the author. If you receive this E-mail in error, please
immediately notify the author and delete this E-mail. Autoliv disclaims all
responsibility and liability for the consequences of any person who fails to
abide by the terms herein.
******************************

reply via email to

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