MQTT:pcb has been used up because too many ack packets were lost

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MQTT:pcb has been used up because too many ack packets were lost

songxz
I am developing MQTT related project and encountered problems in the
situation when I continuously unpluged the Ethernet and made client keep
failing to receive the expected ack packets.

According to the protocol, the related tcp pcb will wait in the stack for
the ack packets before it can be freed. To solve this problem, I called
*tcp_pcb_purge()* in *lwip_netconn_do_close_internal()* to release the tcp
pcb. and set *tpcb->snd_queuelen* to 0. The problem seems to be solved.

I would like to ask is there anyone met similar issues and is there any
better solution to solve this issue?
How do you think about this fix?



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: MQTT:pcb has been used up because too many ack packets were lost

songxz
My solution is like below:

static void
lwip_netconn_do_close_internal(struct netconn *conn)
{
...
if (shut == NETCONN_SHUT_RDWR)

{ close = 1; } else if (shut_rx &&
((tpcb->state == FIN_WAIT_1) ||
(tpcb->state == FIN_WAIT_2) ||
(tpcb->state == CLOSING))) { close = 1; }
else if (shut_tx && ((tpcb->flags & TF_RXCLOSED) != 0))

{ close = 1; }
else

{ close = 0; }
//modified by realtek
if (close) {
tcp_pcb_purge(tpcb);
tpcb->snd_queuelen = 0;
}

/* Set back some callback pointers */
if (close)

{ tcp_arg(tpcb, NULL); }

}



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users