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
now.
The fix was to set a temp variable to ERR_TIMEOUT and assign it
conn->err immediately before returning.
#if LWIP_SO_RCVTIMEO
if (sys_arch_mbox_fetch(conn->recvmbox, (void *)&p,
conn->recv_timeout)==SYS_ARCH_TIMEOUT) {
---> err = ERR_TIMEOUT;
p = NULL;
t = 1;
}
#else
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 */
API_EVENT(conn, NETCONN_EVT_RCVMINUS, len);
/* 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;
}
else
conn->err = err;
return NULL;
}
-----Original Message-----
From: [email protected]
[mailto:[email protected]] 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
api?
> conn->recv_avail is thread safe.
If that is the case I think it should. Could you file a bug?
Kieran
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users