diff --git a/src/api/api_msg.c b/src/api/api_msg.c index 73ccbfef..fdb1a207 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -528,6 +528,13 @@ netconn_alloc(enum netconn_type t, netconn_callback callback) conn->socket = -1; conn->callback = callback; conn->recv_avail = 0; +#if LWIP_TCP + conn->write_msg = NULL; + conn->write_offset = 0; +# if LWIP_TCPIP_CORE_LOCKING + conn->write_delayed = 0; +# endif /* LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_TCP */ #if LWIP_SO_RCVTIMEO conn->recv_timeout = 0; #endif /* LWIP_SO_RCVTIMEO */ diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h index 323ac1b6..ecd22a19 100644 --- a/src/include/lwip/api.h +++ b/src/include/lwip/api.h @@ -138,20 +138,20 @@ struct netconn { int recv_bufsize; #endif /* LWIP_SO_RCVBUF */ u16_t recv_avail; +#if LWIP_TCP /** TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores the message. */ struct api_msg_msg *write_msg; -#if LWIP_TCP /** TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores how much is already sent. */ size_t write_offset; -#endif /* LWIP_TCP */ -#if LWIP_TCPIP_CORE_LOCKING +# if LWIP_TCPIP_CORE_LOCKING /** TCP: when data passed to netconn_write doesn't fit into the send buffer, this temporarily stores whether to wake up the original application task if data couldn't be sent in the first try. */ u8_t write_delayed; -#endif /* LWIP_TCPIP_CORE_LOCKING */ +# endif /* LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_TCP */ /** A callback function that is informed about events for this netconn */ netconn_callback callback; };