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>