Seems I also faced this issue before:)
On Wed, Aug 24, 2022 at 3:53 PM wuchangsheng (C) via lwip-devel <
lwip-devel@nongnu.org> wrote:
>
> connet is non-blocking.
>
>
>
> Call connect first and return -1 and errno=EINPROGRESS, which is as expected.
>
>
>
> The three-way handshake is complete, and pcb->state=ESTABLITED. In the lwip_netconn_do_connected function, conn->state = NETCONN_NONE.
>
>
>
> When the connect function is invoked for the second time, err = ERR_ISCONN is set only when msg->conn->state != NETCONN_NONE is determined in the lwip_netconn_do_connect function. However, in the lwip_netconn_do_connected function, conn->state has been set to NETCONN_NONE. As a result, the error ERR_ISCONN cannot be returned.
>
>
>
>
>
> Therefore, I modify it as follows:
>
>
>
> ---
>
> src/api/api_msg.c | 2 +-
>
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
>
> diff --git a/src/api/api_msg.c b/src/api/api_msg.c
>
> index 3f08e03..9081119 100644
>
> --- a/src/api/api_msg.c
>
> +++ b/src/api/api_msg.c
>
> @@ -1375,7 +1375,7 @@ lwip_netconn_do_connect(void *m)
>
> /* Prevent connect while doing any other action. */
>
> if (msg->conn->state == NETCONN_CONNECT) {
>
> err = ERR_ALREADY;
>
> - } else if (msg->conn->state != NETCONN_NONE) {
>
> + } else if (msg->conn->pcb.tcp->state == ESTABLISHED) {
>
> err = ERR_ISCONN;
>
> } else {
>
> setup_tcp(msg->conn);
>
> _______________________________________________
> lwip-devel mailing list
>
lwip-devel@nongnu.org>
https://lists.nongnu.org/mailman/listinfo/lwip-devel--
此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo