lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Packets stop sending after a while when MEMP_OVERFLOW_C


From: Sebastian Gniazdowski
Subject: Re: [lwip-users] Packets stop sending after a while when MEMP_OVERFLOW_CHECK isn't 2
Date: Wed, 25 Apr 2018 21:20:34 +0200

On 25 April 2018 at 20:47, address@hidden <address@hidden> wrote:
I'd say you're violating lwIP's concurrency/threading requirements and the slowdown of MEMP_OVERFLOW_CHECK==2 hides this.

I've read the pitfalls and sadly must conclude that I don't use callback API, so I cannot see misuse on my side considering the pitfalls. But I suspect some problem in the following: running netconn http server in one thread and socket-API sending of pings in other thread. Is this allowed?

The http server main code is below, I don't visit the server when the crash happens, so no serving function is included. Socket-API use is in the first message.

======= 8< ========== 8< =======

static void http_server_netconn_thread()
{
  struct netconn *conn, *newconn;
  err_t err, accept_err;
 
  /* Create a new TCP connection handle */
  conn = netconn_new(NETCONN_TCP);
 
  if (conn!= NULL)
  {
    /* Bind to port 80 (HTTP) with default IP address */
    err = netconn_bind(conn, NULL, 80);
   
    if (err == ERR_OK)
    {
      /* Put the connection into LISTEN state */
      netconn_listen(conn);
 
      while(1)
      {
        /* accept any icoming connection */
        accept_err = netconn_accept(conn, &newconn);
        if(accept_err == ERR_OK)
        {
          /* serve connection */
          http_server_serve(newconn);

          /* delete connection */
          netconn_delete(newconn);
        }
      }
    }
  }
}

======= 8< ========== 8< =======

--
Best regards,
Sebastian Gniazdowski


reply via email to

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