Workaround for missing disconnected signals on Windows

Sometimes Qt doesn't emit a disconnected signal for closed
sockets (or it happens before we're listening to those).
Manually emitting the signal in our disconnect function if the
socket is not connected fixes the problem.
This commit is contained in:
Benjamin Jemlich 2012-01-04 14:11:58 +01:00
parent 87376a937c
commit eb291db1c8

View File

@ -214,6 +214,11 @@ void Connection::forceFlush() {
}
void Connection::disconnectSocket(bool force) {
if (qtsSocket->state() == QAbstractSocket::UnconnectedState) {
emit connectionClosed(QAbstractSocket::UnknownSocketError, QString());
return;
}
if (force)
qtsSocket->abort();
else