Try to fix compile without TCP (reported by Axel Lin)

This commit is contained in:
Dirk Ziegelmeier 2017-04-19 08:18:15 +02:00
parent 32aa9a41e2
commit 302d84f5b2
3 changed files with 12 additions and 5 deletions

View File

@ -387,8 +387,8 @@ netconn_listen_with_backlog(struct netconn *conn, u8_t backlog)
err_t err_t
netconn_accept(struct netconn *conn, struct netconn **new_conn) netconn_accept(struct netconn *conn, struct netconn **new_conn)
{ {
err_t err;
#if LWIP_TCP #if LWIP_TCP
err_t err;
void *accept_ptr; void *accept_ptr;
struct netconn *newconn; struct netconn *newconn;
#if TCP_LISTEN_BACKLOG #if TCP_LISTEN_BACKLOG
@ -570,6 +570,7 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags)
return ERR_OK; return ERR_OK;
} }
#if LWIP_TCP
static err_t static err_t
netconn_tcp_recvd_msg(struct netconn *conn, u32_t len, struct api_msg* msg) 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; return err;
} }
#if LWIP_TCP
static err_t static err_t
netconn_recv_data_tcp(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags) netconn_recv_data_tcp(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags)
{ {

View File

@ -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_aborted = 0;
const u8_t netconn_reset = 0; const u8_t netconn_reset = 0;
const u8_t netconn_closed = 0; const u8_t netconn_closed = 0;
#endif /* LWIP_TCP */
/** Translate an error to a unique void* passed via an mbox */ /** Translate an error to a unique void* passed via an mbox */
static void* static void*
@ -125,6 +124,7 @@ lwip_netconn_is_err_msg(void *msg, err_t *err)
} }
return 0; return 0;
} }
#endif /* LWIP_TCP */
#if LWIP_RAW #if LWIP_RAW

View File

@ -847,6 +847,7 @@ lwip_listen(int s, int backlog)
return 0; return 0;
} }
#if LWIP_TCP
/* Helper function to loop over receiving pbufs from netconn /* Helper function to loop over receiving pbufs from netconn
* until "len" bytes are received or we're otherwise done. * until "len" bytes are received or we're otherwise done.
* Keeps sock->lastdata for peeking or partly copying. * Keeps sock->lastdata for peeking or partly copying.
@ -957,6 +958,7 @@ lwip_recv_tcp_done:
sock_set_errno(sock, 0); sock_set_errno(sock, 0);
return recvd; return recvd;
} }
#endif
/* Convert a netbuf's address data to struct sockaddr */ /* Convert a netbuf's address data to struct sockaddr */
static int static int
@ -1111,12 +1113,15 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
if (!sock) { if (!sock) {
return -1; return -1;
} }
#if LWIP_TCP
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) { if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) {
ret = lwip_recv_tcp(sock, mem, len, flags); ret = lwip_recv_tcp(sock, mem, len, flags);
lwip_recv_tcp_from(sock, from, fromlen, "lwip_recvfrom", s, ret); lwip_recv_tcp_from(sock, from, fromlen, "lwip_recvfrom", s, ret);
done_socket(sock); done_socket(sock);
return ret; return ret;
} else { } else
#endif
{
u16_t datagram_len = 0; u16_t datagram_len = 0;
struct iovec vec; struct iovec vec;
err_t err; err_t err;
@ -1154,7 +1159,6 @@ int
lwip_recvmsg(int s, struct msghdr *message, int flags) lwip_recvmsg(int s, struct msghdr *message, int flags)
{ {
struct lwip_sock *sock; struct lwip_sock *sock;
int recv_flags = flags;
int buflen, i; int buflen, i;
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void*)message, flags)); 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 (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) {
#if LWIP_TCP #if LWIP_TCP
int recv_flags = flags;
message->msg_flags = 0; message->msg_flags = 0;
/* recv the data */ /* recv the data */
buflen = 0; 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 */ but locking should be OK as well since we only *read* some flags */
SYS_ARCH_PROTECT(lev); SYS_ARCH_PROTECT(lev);
#endif #endif
#if LWIP_TCP
if (sock->conn->pcb.tcp) { if (sock->conn->pcb.tcp) {
if(!(sock->conn->pcb.tcp->flags & TF_RXCLOSED)) { if(!(sock->conn->pcb.tcp->flags & TF_RXCLOSED)) {
op_mode |= O_RDONLY; op_mode |= O_RDONLY;
@ -3226,6 +3232,7 @@ lwip_fcntl(int s, int cmd, int val)
op_mode |= O_WRONLY; op_mode |= O_WRONLY;
} }
} }
#endif
#if LWIP_TCPIP_CORE_LOCKING #if LWIP_TCPIP_CORE_LOCKING
UNLOCK_TCPIP_CORE(); UNLOCK_TCPIP_CORE();
#else #else