diff --git a/src/api/api_msg.c b/src/api/api_msg.c index f7f19c5b..3acee1ca 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -600,7 +600,9 @@ netconn_alloc(enum netconn_type t, netconn_callback callback) conn->acceptmbox = SYS_MBOX_NULL; conn->state = NETCONN_NONE; /* initialize socket to -1 since 0 is a valid socket */ +#if LWIP_SOCKET conn->socket = -1; +#endif /* LWIP_SOCKET */ conn->callback = callback; conn->recv_avail = 0; #if LWIP_TCP diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index cc2fb288..9c402e97 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -151,7 +151,9 @@ struct netconn { by the application thread */ sys_mbox_t acceptmbox; /** only used for socket layer */ +#if LWIP_SOCKET int socket; +#endif /* LWIP_SOCKET */ #if LWIP_SO_RCVTIMEO /** timeout to wait for new data to be received (or connections to arrive for listening netconns) */ @@ -162,7 +164,12 @@ struct netconn { not used for TCP: adjust TCP_WND instead! */ int recv_bufsize; #endif /* LWIP_SO_RCVBUF */ + /** number of bytes currently in recvmbox to be received, + tested against recv_bufsize to limit bytes on recvmbox + for UDP and RAW + @todo: should only be necessary with LWIP_SO_RCVBUF==1 */ s16_t recv_avail; + /** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */ u8_t flags; #if LWIP_TCP /** TCP: when data passed to netconn_write doesn't fit into the send buffer,