[Top][All Lists]

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

RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c

From: David Shmelzer
Subject: RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c
Date: Tue, 13 Oct 2009 11:13:55 -0400

I tried filing a bug but failed. I registered, I installed the cert, but
nothing worked.

Anyway, here's how I fixed the problem in netconn_recv().
There's probably a better way but this one's been running for many hours
The fix was to set a temp variable to ERR_TIMEOUT and assign it
conn->err immediately before returning.

    if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&p,
conn->recv_timeout)==SYS_ARCH_TIMEOUT) {
--->  err = ERR_TIMEOUT;
      p = NULL;
      t = 1;
    sys_arch_mbox_fetch(conn->recvmbox, (void *)&p, 0);
#endif /* LWIP_SO_RCVTIMEO*/

    if (p != NULL) {
      len = p->tot_len;
      SYS_ARCH_DEC(conn->recv_avail, len);
    } else {
      len = 0;

    /* Register event with callback */

    /* If we are closed, we indicate that we no longer wish to use the
socket */
    if (p == NULL) {
      memp_free(MEMP_NETBUF, buf);
      /* Avoid to lose any previous error code */
--->  if (conn->err == ERR_OK && err != ERR_TIMEOUT) {
        conn->err = ERR_CLSD;
        conn->err = err;
      return NULL;

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Kieran Mansley
Sent: Thursday, October 08, 2009 4:28 AM
To: Mailing list for lwIP users
Subject: RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c

On Wed, 2009-10-07 at 15:54 -0400, David Shmelzer wrote:
> I traced the problem to conn->err being assigned a value in separate 
> threads.
> One in recv_tcp() and another in netconn_recv().
> recv_tcp() is called from the tcpip_thread and netconn_recv() is 
> called from a separate thread.
> Am I using netconns incorrectly? 
> If so, shouldn't conn->err be a thread safe variable since it is 
> accessed from tcpip_thread as well as the thread using the netconn
> conn->recv_avail is thread safe.

If that is the case I think it should.  Could you file a bug?


lwip-users mailing list

reply via email to

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