Change client ping send interval to 9 sec
This commit is contained in:
parent
ec3690fd29
commit
4d6f46b06e
1 changed files with 5 additions and 5 deletions
|
@ -15,7 +15,7 @@ RemoteClient::RemoteClient(QObject *parent)
|
||||||
: AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0)
|
: AbstractClient(parent), timeRunning(0), lastDataReceived(0), messageInProgress(false), handshakeStarted(false), messageLength(0)
|
||||||
{
|
{
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
timer->setInterval(1000);
|
timer->setInterval(9000);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(ping()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(ping()));
|
||||||
|
|
||||||
socket = new QTcpSocket(this);
|
socket = new QTcpSocket(this);
|
||||||
|
@ -23,7 +23,7 @@ RemoteClient::RemoteClient(QObject *parent)
|
||||||
connect(socket, SIGNAL(connected()), this, SLOT(slotConnected()));
|
connect(socket, SIGNAL(connected()), this, SLOT(slotConnected()));
|
||||||
connect(socket, SIGNAL(readyRead()), this, SLOT(readData()));
|
connect(socket, SIGNAL(readyRead()), this, SLOT(readData()));
|
||||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError)));
|
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketError(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, SLOT(processServerIdentificationEvent(const Event_ServerIdentification &)));
|
connect(this, SIGNAL(serverIdentificationEventReceived(const Event_ServerIdentification &)), this, SLOT(processServerIdentificationEvent(const Event_ServerIdentification &)));
|
||||||
connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, SLOT(processConnectionClosedEvent(Event_ConnectionClosed)));
|
connect(this, SIGNAL(connectionClosedEventReceived(Event_ConnectionClosed)), this, SLOT(processConnectionClosedEvent(Event_ConnectionClosed)));
|
||||||
connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, SLOT(doConnectToServer(QString, unsigned int, QString, QString)));
|
connect(this, SIGNAL(sigConnectToServer(QString, unsigned int, QString, QString)), this, SLOT(doConnectToServer(QString, unsigned int, QString, QString)));
|
||||||
|
@ -47,12 +47,12 @@ void RemoteClient::slotConnected()
|
||||||
{
|
{
|
||||||
timeRunning = lastDataReceived = 0;
|
timeRunning = lastDataReceived = 0;
|
||||||
timer->start();
|
timer->start();
|
||||||
|
|
||||||
// dirty hack to be compatible with v14 server
|
// dirty hack to be compatible with v14 server
|
||||||
sendCommandContainer(CommandContainer());
|
sendCommandContainer(CommandContainer());
|
||||||
getNewCmdId();
|
getNewCmdId();
|
||||||
// end of hack
|
// end of hack
|
||||||
|
|
||||||
setStatus(StatusAwaitingWelcome);
|
setStatus(StatusAwaitingWelcome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void RemoteClient::ping()
|
||||||
pend->deleteLater();
|
pend->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxTime = timeRunning - lastDataReceived;
|
int maxTime = timeRunning - lastDataReceived;
|
||||||
emit maxPingTime(maxTime, maxTimeout);
|
emit maxPingTime(maxTime, maxTimeout);
|
||||||
if (maxTime >= maxTimeout) {
|
if (maxTime >= maxTimeout) {
|
||||||
|
|
Loading…
Reference in a new issue