[Browser] Stop PingHelper on refresh

pull/367/head
Koncord 7 years ago
parent 647661daf9
commit 5b8f4f3e92

@ -14,6 +14,12 @@ void PingHelper::Add(int row, const AddrPair &addrPair)
pingThread->start(); pingThread->start();
} }
void PingHelper::Reset()
{
//if (pingThread->isRunning())
Stop();
}
void PingHelper::Stop() void PingHelper::Stop()
{ {
emit pingUpdater->stop(); emit pingUpdater->stop();

@ -17,6 +17,7 @@ class PingHelper : public QObject
Q_OBJECT Q_OBJECT
public: public:
void Reset();
void Add(int row, const AddrPair &addrPair); void Add(int row, const AddrPair &addrPair);
void Stop(); void Stop();
void SetModel(QAbstractTableModel *model); void SetModel(QAbstractTableModel *model);

@ -42,7 +42,7 @@ void PingUpdater::process()
unsigned ping = PingRakNetServer(server.second.first.toLatin1(), server.second.second); unsigned ping = PingRakNetServer(server.second.first.toLatin1(), server.second.second);
qDebug() << "Pong from" << server.second.first + "|" + QString::number(server.second.second) qDebug() << "Pong from" << server.second.first + "|" + QString::number(server.second.second)
<< ":" << ping << "ms"; << ":" << ping << "ms" << "Sizeof servers: " << servers.size();
emit updateModel(server.first, ping); emit updateModel(server.first, ping);
} }

@ -29,6 +29,7 @@ void QueryHelper::refresh()
if (!queryThread->isRunning()) if (!queryThread->isRunning())
{ {
_model->removeRows(0, _model->rowCount()); _model->removeRows(0, _model->rowCount());
PingHelper::Get().Stop();
queryThread->start(); queryThread->start();
emit started(); emit started();
} }

Loading…
Cancel
Save