lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #19345] tcpip_apimsg+api_msg_post problem


From: Frédéric Bernon
Subject: [lwip-devel] [bug #19345] tcpip_apimsg+api_msg_post problem
Date: Mon, 19 Mar 2007 16:53:47 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2

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

                 Summary: tcpip_apimsg+api_msg_post problem
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: fbernon
            Submitted on: lundi 19.03.2007 à 17:53
                Category: None
                Severity: 4 - Important
              Item Group: Faulty Behaviour
                  Status: In Progress
                 Privacy: Public
             Assigned to: fbernon
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

tcpip_apimsg & api_msg_post functions don't have any return type. So, if we
got any memp_malloc error, api_msg_post's caller doesn't know that the
message is not sent. And in api_lib.c, we always wait an answer with a
sys_mbox_fetch(conn->mbox, NULL); But tcpip_thread will never answers,
because he never got the message.

This is not a new problem. I can find in forum some threads :

- "bug&patch: when an api_msg is lost tcp get stuck" (May 2005)
- "API code issues" (May 2006)

The first thing to change in api is to change return types from "void" to
"err_t" for tcpip_apimsg & api_msg_post (like this):

err_t
tcpip_apimsg(struct api_msg *apimsg)
{
  struct tcpip_msg *msg;
  msg = memp_malloc(MEMP_TCPIP_MSG);
  if (msg == NULL) {
    return ERR_MEM;
  }
  msg->type = TCPIP_MSG_API;
  msg->msg.apimsg = apimsg;
  sys_mbox_post(mbox, msg);
  return ERR_OK;
}

err_t
api_msg_post(struct api_msg *msg)
{
  return tcpip_apimsg(msg);
}

The second thing is to change in api_lib.c each call like this :

  ...
  if (api_msg_post(&msg)==ERR_OK)
   { sys_mbox_fetch(conn->mbox, NULL);
     ...
   }
  else
   { ... //error handler
   }
  ...

Good for you?







    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message posté via/par Savannah
  http://savannah.nongnu.org/





reply via email to

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