Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
4d6f46b0
Commit
4d6f46b0
authored
Jun 29, 2014
by
Daenyth
Browse files
Change client ping send interval to 9 sec
parent
ec3690fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/remoteclient.cpp
View file @
4d6f46b0
...
...
@@ -15,7 +15,7 @@ RemoteClient::RemoteClient(QObject *parent)
:
AbstractClient
(
parent
),
timeRunning
(
0
),
lastDataReceived
(
0
),
messageInProgress
(
false
),
handshakeStarted
(
false
),
messageLength
(
0
)
{
timer
=
new
QTimer
(
this
);
timer
->
setInterval
(
1
000
);
timer
->
setInterval
(
9
000
);
connect
(
timer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
ping
()));
socket
=
new
QTcpSocket
(
this
);
...
...
@@ -23,7 +23,7 @@ RemoteClient::RemoteClient(QObject *parent)
connect
(
socket
,
SIGNAL
(
connected
()),
this
,
SLOT
(
slotConnected
()));
connect
(
socket
,
SIGNAL
(
readyRead
()),
this
,
SLOT
(
readData
()));
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
(
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
)));
...
...
@@ -47,12 +47,12 @@ void RemoteClient::slotConnected()
{
timeRunning
=
lastDataReceived
=
0
;
timer
->
start
();
// dirty hack to be compatible with v14 server
sendCommandContainer
(
CommandContainer
());
getNewCmdId
();
// end of hack
setStatus
(
StatusAwaitingWelcome
);
}
...
...
@@ -208,7 +208,7 @@ void RemoteClient::ping()
pend
->
deleteLater
();
}
}
int
maxTime
=
timeRunning
-
lastDataReceived
;
emit
maxPingTime
(
maxTime
,
maxTimeout
);
if
(
maxTime
>=
maxTimeout
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment