QModbusTcpServer: do not store client sockets in a separate list


The 'connections' list was used only for tracking who is connected.
We can just call
 QObject::findChildren<QTcpSocket *>
on the QTcpServer instance for that.

This also fixes the issue with removing data from the container while
iterating over it.

The old code was also removing the data from the container while
iterating over it, because calling socket->disconnectFromHost() from
a ranged-for loop results in sending a QTcpSocket::disconnected()
signal and immediately calling the connected lambda.
This patch fixes the issue.

Pick-to: 6.5 6.4 6.2
Change-Id: I24d8c197545162af232d438d0941faba6ffc94d0
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
commita18c97f1a897e4653a47a45976d78bea5a2243be
parentbfb62b60ad6873ad1912df0f08ce9cf7fd80447b
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeThu, 9 Feb 2023 10:11:53 +0100