void RemoteClient::ping() { QMutableMapIterator<int, PendingCommand *> i(pendingCommands); while (i.hasNext()) { PendingCommand *pend = i.next().value(); if (pend->tick() > maxTimeout) { i.remove(); pend->deleteLater(); } } int maxTime = timeRunning - lastDataReceived; emit maxPingTime(maxTime, maxTimeout); if (maxTime >= maxTimeout) { disconnectFromServer(); emit serverTimeout(); } else { sendCommand(prepareSessionCommand(Command_Ping())); ++timeRunning; } }