mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
add shutdown short circuiting to datagram processor
This commit is contained in:
parent
b1e46c1bc8
commit
e66f12f958
3 changed files with 14 additions and 6 deletions
|
@ -534,6 +534,7 @@ void Application::aboutToQuit() {
|
||||||
|
|
||||||
void Application::cleanupBeforeQuit() {
|
void Application::cleanupBeforeQuit() {
|
||||||
|
|
||||||
|
_datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
|
||||||
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
||||||
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
|
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
|
||||||
|
|
||||||
|
@ -584,8 +585,6 @@ Application::~Application() {
|
||||||
_entities.getTree()->setSimulation(NULL);
|
_entities.getTree()->setSimulation(NULL);
|
||||||
tree->unlock();
|
tree->unlock();
|
||||||
|
|
||||||
qInstallMessageHandler(NULL);
|
|
||||||
|
|
||||||
// ask the datagram processing thread to quit and wait until it is done
|
// ask the datagram processing thread to quit and wait until it is done
|
||||||
_nodeThread->quit();
|
_nodeThread->quit();
|
||||||
_nodeThread->wait();
|
_nodeThread->wait();
|
||||||
|
@ -606,6 +605,8 @@ Application::~Application() {
|
||||||
DependencyManager::destroy<GeometryCache>();
|
DependencyManager::destroy<GeometryCache>();
|
||||||
DependencyManager::destroy<ScriptCache>();
|
DependencyManager::destroy<ScriptCache>();
|
||||||
DependencyManager::destroy<SoundCache>();
|
DependencyManager::destroy<SoundCache>();
|
||||||
|
|
||||||
|
qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::initializeGL() {
|
void Application::initializeGL() {
|
||||||
|
|
|
@ -30,6 +30,10 @@ DatagramProcessor::DatagramProcessor(QObject* parent) :
|
||||||
void DatagramProcessor::processDatagrams() {
|
void DatagramProcessor::processDatagrams() {
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||||
"DatagramProcessor::processDatagrams()");
|
"DatagramProcessor::processDatagrams()");
|
||||||
|
|
||||||
|
if (_isShuttingDown) {
|
||||||
|
return; // bail early... we're shutting down.
|
||||||
|
}
|
||||||
|
|
||||||
HifiSockAddr senderSockAddr;
|
HifiSockAddr senderSockAddr;
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,17 @@ public:
|
||||||
int getOutByteCount() const { return _outByteCount; }
|
int getOutByteCount() const { return _outByteCount; }
|
||||||
|
|
||||||
void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; }
|
void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; }
|
||||||
|
|
||||||
|
void shutdown() { _isShuttingDown = true; }
|
||||||
public slots:
|
public slots:
|
||||||
void processDatagrams();
|
void processDatagrams();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _inPacketCount;
|
int _inPacketCount = 0;
|
||||||
int _outPacketCount;
|
int _outPacketCount = 0;
|
||||||
int _inByteCount;
|
int _inByteCount = 0;
|
||||||
int _outByteCount;
|
int _outByteCount = 0;
|
||||||
|
bool _isShuttingDown = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DatagramProcessor_h
|
#endif // hifi_DatagramProcessor_h
|
||||||
|
|
Loading…
Reference in a new issue