Fix wifi ping spikes

Moves the setting of Qt's bearer poll timeout earlier to be sure
it's caught.
This commit is contained in:
Atlante45 2016-01-21 14:46:45 -08:00
parent 098b7a4ff3
commit db18d188b8
8 changed files with 18 additions and 14 deletions

View file

@ -29,10 +29,6 @@
AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
QCoreApplication(argc, argv)
{
// to work around the Qt constant wireless scanning, set the env for polling interval very high
const QByteArray EXTREME_BEARER_POLL_TIMEOUT = QString::number(INT_MAX).toLocal8Bit();
qputenv("QT_BEARER_POLL_TIMEOUT", EXTREME_BEARER_POLL_TIMEOUT);
# ifndef WIN32
setvbuf(stdout, NULL, _IOLBF, 0);
# endif

View file

@ -9,11 +9,15 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "AssignmentClientApp.h"
#include <QtCore/QDebug>
#include <SharedUtil.h>
#include "AssignmentClientApp.h"
int main(int argc, char* argv[]) {
disableQtBearerPoll(); // Fixes wifi ping spikes
AssignmentClientApp app(argc, argv);
int acReturn = app.exec();

View file

@ -65,10 +65,6 @@ DomainServer::DomainServer(int argc, char* argv[]) :
LogUtils::init();
Setting::init();
// to work around the Qt constant wireless scanning, set the env for polling interval very high
const QByteArray EXTREME_BEARER_POLL_TIMEOUT = QString::number(INT_MAX).toLocal8Bit();
qputenv("QT_BEARER_POLL_TIMEOUT", EXTREME_BEARER_POLL_TIMEOUT);
connect(this, &QCoreApplication::aboutToQuit, this, &DomainServer::aboutToQuit);

View file

@ -23,6 +23,8 @@
#include "DomainServer.h"
int main(int argc, char* argv[]) {
disableQtBearerPoll(); // Fixes wifi ping spikes
#ifndef WIN32
setvbuf(stdout, NULL, _IOLBF, 0);
#endif

View file

@ -422,9 +422,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
auto controllerScriptingInterface = DependencyManager::get<controller::ScriptingInterface>().data();
_controllerScriptingInterface = dynamic_cast<ControllerScriptingInterface*>(controllerScriptingInterface);
// to work around the Qt constant wireless scanning, set the env for polling interval very high
const QByteArray EXTREME_BEARER_POLL_TIMEOUT = QString::number(INT_MAX).toLocal8Bit();
qputenv("QT_BEARER_POLL_TIMEOUT", EXTREME_BEARER_POLL_TIMEOUT);
_entityClipboard->createRootElement();

View file

@ -25,6 +25,8 @@
#include "MainWindow.h"
int main(int argc, const char* argv[]) {
disableQtBearerPoll(); // Fixes wifi ping spikes
QString applicationName = "High Fidelity Interface - " + qgetenv("USERNAME");
bool instanceMightBeRunning = true;
@ -81,7 +83,6 @@ int main(int argc, const char* argv[]) {
#endif
}
QElapsedTimer startupTime;
startupTime.start();

View file

@ -685,3 +685,9 @@ bool similarStrings(const QString& stringA, const QString& stringB) {
return similarity >= SIMILAR_ENOUGH;
}
void disableQtBearerPoll() {
// to work around the Qt constant wireless scanning, set the env for polling interval very high
const QByteArray EXTREME_BEARER_POLL_TIMEOUT = QString::number(INT_MAX).toLocal8Bit();
qputenv("QT_BEARER_POLL_TIMEOUT", EXTREME_BEARER_POLL_TIMEOUT);
}

View file

@ -172,4 +172,6 @@ uint qHash(const std::shared_ptr<T>& ptr, uint seed = 0)
return qHash(ptr.get(), seed);
}
void disableQtBearerPoll();
#endif // hifi_SharedUtil_h