sys.h, api_lib.c, api_msg.c, sockets.c: fix bug #21698: "netconn->recv_avail is not protected" by using new macros for interlocked access to modify/test netconn->recv_avail.

This commit is contained in:
goldsimon
2007-12-21 14:59:10 +00:00
parent 1cb470662b
commit 48e62e25e9
5 changed files with 64 additions and 9 deletions

View File

@@ -358,7 +358,7 @@ netconn_recv(struct netconn *conn)
if (p != NULL) {
len = p->tot_len;
conn->recv_avail -= len;
SYS_ARCH_DEC(conn->recv_avail, len);
} else {
len = 0;
}
@@ -401,7 +401,7 @@ netconn_recv(struct netconn *conn)
sys_arch_mbox_fetch(conn->recvmbox, (void *)&buf, 0);
#endif /* LWIP_SO_RCVTIMEO*/
if (buf!=NULL) {
conn->recv_avail -= buf->p->tot_len;
SYS_ARCH_DEC(conn->recv_avail, buf->p->tot_len);
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len);
}