[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
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: 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
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
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users
- [lwip-users] sys_arch_mbox_fetch() peek, David Shmelzer, 2009/10/05
- Re: [lwip-users] sys_arch_mbox_fetch() peek, Simon Goldschmidt, 2009/10/06
- [lwip-users] conn->err = ERR_CLSD in api_lib.c, David Shmelzer, 2009/10/06
- Re: [lwip-users] conn->err = ERR_CLSD in api_lib.c, Kieran Mansley, 2009/10/07
- RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c, David Shmelzer, 2009/10/07
- RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c, David Shmelzer, 2009/10/07
- RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c, Kieran Mansley, 2009/10/08
- RE: [lwip-users] conn->err = ERR_CLSD in api_lib.c,
David Shmelzer <=
- [lwip-users] TCP payload is doubled, David Shmelzer, 2009/10/13
- Re: [lwip-users] TCP payload is doubled, David Empson, 2009/10/13
- RE: [lwip-users] TCP payload is doubled, David Shmelzer, 2009/10/14
- RE: [lwip-users] TCP payload is doubled, Bill Auerbach, 2009/10/14
- RE: [lwip-users] TCP payload is doubled, David Shmelzer, 2009/10/15
- SV: [lwip-users] TCP payload is doubled, Jan Wester, 2009/10/16
- RE: [lwip-users] TCP payload is doubled, David Shmelzer, 2009/10/16
- RE: [lwip-users] TCP payload is doubled, Kieran Mansley, 2009/10/21
- RE: [lwip-users] TCP payload is doubled, Kieran Mansley, 2009/10/21
- Re: SV: [lwip-users] TCP payload is doubled, Kieran Mansley, 2009/10/21