mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:30:39 +02:00
Faceshift fail to connect only notifies log once
This commit is contained in:
parent
cdcd4f9915
commit
e43758a115
2 changed files with 12 additions and 5 deletions
|
@ -20,6 +20,7 @@ const quint16 FACESHIFT_PORT = 33433;
|
||||||
|
|
||||||
Faceshift::Faceshift() :
|
Faceshift::Faceshift() :
|
||||||
_tcpEnabled(false),
|
_tcpEnabled(false),
|
||||||
|
_tcpRetryCount(0),
|
||||||
_lastTrackingStateReceived(0),
|
_lastTrackingStateReceived(0),
|
||||||
_eyeGazeLeftPitch(0.0f),
|
_eyeGazeLeftPitch(0.0f),
|
||||||
_eyeGazeLeftYaw(0.0f),
|
_eyeGazeLeftYaw(0.0f),
|
||||||
|
@ -88,7 +89,9 @@ void Faceshift::setTCPEnabled(bool enabled) {
|
||||||
|
|
||||||
void Faceshift::connectSocket() {
|
void Faceshift::connectSocket() {
|
||||||
if (_tcpEnabled) {
|
if (_tcpEnabled) {
|
||||||
qDebug("Faceshift: Connecting...\n");
|
if (!_tcpRetryCount) {
|
||||||
|
qDebug("Faceshift: Connecting...\n");
|
||||||
|
}
|
||||||
|
|
||||||
_tcpSocket.connectToHost("localhost", FACESHIFT_PORT);
|
_tcpSocket.connectToHost("localhost", FACESHIFT_PORT);
|
||||||
_tracking = false;
|
_tracking = false;
|
||||||
|
@ -105,11 +108,14 @@ void Faceshift::noteConnected() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Faceshift::noteError(QAbstractSocket::SocketError error) {
|
void Faceshift::noteError(QAbstractSocket::SocketError error) {
|
||||||
qDebug() << "Faceshift: " << _tcpSocket.errorString() << "\n";
|
if (!_tcpRetryCount) {
|
||||||
|
// Only spam log with fail to connect the first time, so that we can keep waiting for server
|
||||||
// reconnect after a delay
|
qDebug() << "Faceshift: " << _tcpSocket.errorString() << "\n";
|
||||||
|
}
|
||||||
|
// retry connection after a 2 second delay
|
||||||
if (_tcpEnabled) {
|
if (_tcpEnabled) {
|
||||||
QTimer::singleShot(1000, this, SLOT(connectSocket()));
|
_tcpRetryCount++;
|
||||||
|
QTimer::singleShot(2000, this, SLOT(connectSocket()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,7 @@ private:
|
||||||
QUdpSocket _udpSocket;
|
QUdpSocket _udpSocket;
|
||||||
fs::fsBinaryStream _stream;
|
fs::fsBinaryStream _stream;
|
||||||
bool _tcpEnabled;
|
bool _tcpEnabled;
|
||||||
|
int _tcpRetryCount;
|
||||||
bool _tracking;
|
bool _tracking;
|
||||||
uint64_t _lastTrackingStateReceived;
|
uint64_t _lastTrackingStateReceived;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue