Fixed compilation for LWIP_SO_RCVBUF==0

This commit is contained in:
goldsimon 2010-02-13 10:06:42 +00:00
parent 8fbaf0304a
commit c49a3ab2d6

View File

@ -81,19 +81,17 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
struct pbuf *q; struct pbuf *q;
struct netbuf *buf; struct netbuf *buf;
struct netconn *conn; struct netconn *conn;
#if LWIP_SO_RCVBUF
int recv_avail;
#endif /* LWIP_SO_RCVBUF */
LWIP_UNUSED_ARG(addr); LWIP_UNUSED_ARG(addr);
conn = (struct netconn *)arg; conn = (struct netconn *)arg;
if ((conn != NULL) && sys_mbox_valid(&conn->recvmbox)) {
#if LWIP_SO_RCVBUF #if LWIP_SO_RCVBUF
SYS_ARCH_GET(conn->recv_avail, recv_avail); int recv_avail;
if ((conn != NULL) && sys_mbox_valid(&conn->recvmbox) && SYS_ARCH_GET(conn->recv_avail, recv_avail);
((recv_avail + (int)(p->tot_len)) <= conn->recv_bufsize)) { if ((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize) {
#else /* LWIP_SO_RCVBUF */ return 0;
if ((conn != NULL) && (conn->recvmbox != SYS_MBOX_NULL)) { }
#endif /* LWIP_SO_RCVBUF */ #endif /* LWIP_SO_RCVBUF */
/* copy the whole packet into new pbufs */ /* copy the whole packet into new pbufs */
q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
@ -162,7 +160,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox) || if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox) ||
((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize)) { ((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize)) {
#else /* LWIP_SO_RCVBUF */ #else /* LWIP_SO_RCVBUF */
if ((conn == NULL) || (conn->recvmbox == SYS_MBOX_NULL)) { if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox)) {
#endif /* LWIP_SO_RCVBUF */ #endif /* LWIP_SO_RCVBUF */
pbuf_free(p); pbuf_free(p);
return; return;