Open oktal3700 opened 2 years ago
The issue could possibly be in CFsdClient
. If there are too many packets waiting, the method readDataFromSocketMaxLines
will return after scheduling itself to be called again in a few milliseconds. The disconnection could occur before the method is called again, and therefore before the error packet has been read.
A solution could be along the following lines:
const QByteArray allBytes = m_socket->peek(m_socket->bytesAvailable());
int index = allBytes.indexOf("\r\n$ER");
if (index < 0) { index = allBytes.indexOf("\r\n$!!"); }
if (index >= 0)
{
index += 2;
const int end = allBytes.indexOf("\r\n", index);
if (end >= 0)
{
const QByteArray dataEncoded = allBytes.mid(index, end - index);
// ...
}
}
When the server sends a kick packet or error packet and then disconnects the socket, the socket error seems to take priority in the swift GUI, so the server error or kick message gets hidden.