diff --git a/src/api/api_lib.c b/src/api/api_lib.c index d3eaaf24..dc0cd8d6 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -387,8 +387,8 @@ netconn_listen_with_backlog(struct netconn *conn, u8_t backlog) err_t netconn_accept(struct netconn *conn, struct netconn **new_conn) { - err_t err; #if LWIP_TCP + err_t err; void *accept_ptr; struct netconn *newconn; #if TCP_LISTEN_BACKLOG @@ -570,6 +570,7 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags) return ERR_OK; } +#if LWIP_TCP static err_t netconn_tcp_recvd_msg(struct netconn *conn, u32_t len, struct api_msg* msg) { @@ -596,7 +597,6 @@ netconn_tcp_recvd(struct netconn *conn, u32_t len) return err; } -#if LWIP_TCP static err_t netconn_recv_data_tcp(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags) { diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 32c9e7f9..eff424a1 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -88,7 +88,6 @@ static err_t lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_ const u8_t netconn_aborted = 0; const u8_t netconn_reset = 0; const u8_t netconn_closed = 0; -#endif /* LWIP_TCP */ /** Translate an error to a unique void* passed via an mbox */ static void* @@ -125,6 +124,7 @@ lwip_netconn_is_err_msg(void *msg, err_t *err) } return 0; } +#endif /* LWIP_TCP */ #if LWIP_RAW diff --git a/src/api/sockets.c b/src/api/sockets.c index b60a9a59..8ad82d42 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -847,6 +847,7 @@ lwip_listen(int s, int backlog) return 0; } +#if LWIP_TCP /* Helper function to loop over receiving pbufs from netconn * until "len" bytes are received or we're otherwise done. * Keeps sock->lastdata for peeking or partly copying. @@ -957,6 +958,7 @@ lwip_recv_tcp_done: sock_set_errno(sock, 0); return recvd; } +#endif /* Convert a netbuf's address data to struct sockaddr */ static int @@ -1111,12 +1113,15 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags, if (!sock) { return -1; } +#if LWIP_TCP if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { ret = lwip_recv_tcp(sock, mem, len, flags); lwip_recv_tcp_from(sock, from, fromlen, "lwip_recvfrom", s, ret); done_socket(sock); return ret; - } else { + } else +#endif + { u16_t datagram_len = 0; struct iovec vec; err_t err; @@ -1154,7 +1159,6 @@ int lwip_recvmsg(int s, struct msghdr *message, int flags) { struct lwip_sock *sock; - int recv_flags = flags; int buflen, i; LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void*)message, flags)); @@ -1186,6 +1190,7 @@ lwip_recvmsg(int s, struct msghdr *message, int flags) if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { #if LWIP_TCP + int recv_flags = flags; message->msg_flags = 0; /* recv the data */ buflen = 0; @@ -3218,6 +3223,7 @@ lwip_fcntl(int s, int cmd, int val) but locking should be OK as well since we only *read* some flags */ SYS_ARCH_PROTECT(lev); #endif +#if LWIP_TCP if (sock->conn->pcb.tcp) { if(!(sock->conn->pcb.tcp->flags & TF_RXCLOSED)) { op_mode |= O_RDONLY; @@ -3226,6 +3232,7 @@ lwip_fcntl(int s, int cmd, int val) op_mode |= O_WRONLY; } } +#endif #if LWIP_TCPIP_CORE_LOCKING UNLOCK_TCPIP_CORE(); #else