mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
all 4 types of assignment-client appear to exit cleanly, now
This commit is contained in:
parent
e7d8bccd5d
commit
009bb9dc71
9 changed files with 41 additions and 10 deletions
|
@ -126,7 +126,15 @@ void AssignmentClient::stopAssignmentClient() {
|
|||
|
||||
|
||||
void AssignmentClient::aboutToQuit() {
|
||||
qDebug() << "AssignmentClient::aboutToQuit start";
|
||||
stopAssignmentClient();
|
||||
qDebug() << "AssignmentClient::aboutToQuit end";
|
||||
// clear the log handler so that Qt doesn't call the destructor on LogHandler
|
||||
qInstallMessageHandler(0);
|
||||
// clear out pointer to the assignment so the destructor gets called. if we don't do this here,
|
||||
// it will get destroyed along with all the other "static" stuff. various static member variables
|
||||
// will be destroyed first and things go wrong.
|
||||
_currentAssignment.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -167,7 +167,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (parser.isSet(numChildsOption)) {
|
||||
if (minForks && minForks > numForks) {
|
||||
qCritical() << "--min can't be more than -n";
|
||||
|
@ -189,8 +188,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
|
|||
AssignmentClientMonitor monitor(numForks, minForks, maxForks, requestAssignmentType, assignmentPool,
|
||||
walletUUID, assignmentServerHostname, assignmentServerPort);
|
||||
connect(this, &QCoreApplication::aboutToQuit, &monitor, &AssignmentClientMonitor::aboutToQuit);
|
||||
|
||||
|
||||
exec();
|
||||
} else {
|
||||
AssignmentClient client(ppid, requestAssignmentType, assignmentPool,
|
||||
|
|
|
@ -83,6 +83,8 @@ void AssignmentClientMonitor::stopChildProcesses() {
|
|||
|
||||
void AssignmentClientMonitor::aboutToQuit() {
|
||||
stopChildProcesses();
|
||||
// clear the log handler so that Qt doesn't call the destructor on LogHandler
|
||||
qInstallMessageHandler(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -163,3 +163,5 @@ void EntityServer::readAdditionalConfiguration(const QJsonObject& settingsSectio
|
|||
EntityTree* tree = static_cast<EntityTree*>(_tree);
|
||||
tree->setWantEditLogging(wantEditLogging);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -239,8 +239,10 @@ OctreeServer::OctreeServer(const QByteArray& packet) :
|
|||
_octreeInboundPacketProcessor(NULL),
|
||||
_persistThread(NULL),
|
||||
_started(time(0)),
|
||||
_startedUSecs(usecTimestampNow())
|
||||
_startedUSecs(usecTimestampNow()),
|
||||
_nodeList(DependencyManager::get<NodeList>())
|
||||
{
|
||||
|
||||
if (_instance) {
|
||||
qDebug() << "Octree Server starting... while old instance still running _instance=["<<_instance<<"] this=[" << this << "]";
|
||||
}
|
||||
|
@ -1098,7 +1100,7 @@ void OctreeServer::readConfiguration() {
|
|||
}
|
||||
|
||||
void OctreeServer::run() {
|
||||
qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
||||
// qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
||||
|
||||
_safeServerName = getMyServerName();
|
||||
|
||||
|
@ -1222,8 +1224,15 @@ void OctreeServer::forceNodeShutdown(SharedNodePointer node) {
|
|||
void OctreeServer::aboutToFinish() {
|
||||
qDebug() << qPrintable(_safeServerName) << "server STARTING about to finish...";
|
||||
qDebug() << qPrintable(_safeServerName) << "inform Octree Inbound Packet Processor that we are shutting down...";
|
||||
_octreeInboundPacketProcessor->terminating();
|
||||
|
||||
|
||||
if (_octreeInboundPacketProcessor) {
|
||||
_octreeInboundPacketProcessor->terminating();
|
||||
}
|
||||
|
||||
if (_jurisdictionSender) {
|
||||
_jurisdictionSender->terminating();
|
||||
}
|
||||
|
||||
DependencyManager::get<NodeList>()->eachNode([this](const SharedNodePointer& node) {
|
||||
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
|
||||
forceNodeShutdown(node);
|
||||
|
@ -1231,6 +1240,7 @@ void OctreeServer::aboutToFinish() {
|
|||
|
||||
if (_persistThread) {
|
||||
_persistThread->aboutToFinish();
|
||||
_persistThread->terminating();
|
||||
}
|
||||
|
||||
qDebug() << qPrintable(_safeServerName) << "server ENDING about to finish...";
|
||||
|
|
|
@ -238,6 +238,9 @@ protected:
|
|||
static QMutex _threadsDidPacketDistributorMutex;
|
||||
static QMutex _threadsDidHandlePacketSendMutex;
|
||||
static QMutex _threadsDidCallWriteDatagramMutex;
|
||||
|
||||
// keep a pointer to node list so that it doesn't get shut down before this class.
|
||||
QSharedPointer<NodeList> _nodeList;
|
||||
};
|
||||
|
||||
#endif // hifi_OctreeServer_h
|
||||
|
|
|
@ -222,7 +222,7 @@ protected:
|
|||
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
||||
void operator=(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
||||
|
||||
~LimitedNodeList() {
|
||||
virtual ~LimitedNodeList() {
|
||||
qDebug() << "XXXXXXXXXXXXXXXXXXXX ~LimitedNodeList called";
|
||||
}
|
||||
|
||||
|
@ -241,8 +241,6 @@ protected:
|
|||
HifiSockAddr _localSockAddr;
|
||||
HifiSockAddr _publicSockAddr;
|
||||
HifiSockAddr _stunSockAddr;
|
||||
|
||||
QTimer* _silentNodeTimer;
|
||||
|
||||
// XXX can BandwidthRecorder be used for this?
|
||||
int _numCollectedPackets;
|
||||
|
|
|
@ -45,6 +45,11 @@ class NodeList : public LimitedNodeList {
|
|||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
virtual ~NodeList() {
|
||||
qDebug() << "XXXXXXXXXXXXXXXXXXXX ~NodeList called";
|
||||
}
|
||||
|
||||
|
||||
NodeType_t getOwnerType() const { return _ownerType; }
|
||||
void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; }
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <qset.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
const int VERBOSE_LOG_INTERVAL_SECONDS = 5;
|
||||
|
||||
enum LogMsgType {
|
||||
|
@ -34,6 +36,10 @@ class LogHandler : public QObject {
|
|||
Q_OBJECT
|
||||
public:
|
||||
static LogHandler& getInstance();
|
||||
|
||||
virtual ~LogHandler() {
|
||||
std::cerr << "XXXXXXXX ~LogHandler()\n";
|
||||
}
|
||||
|
||||
/// sets the target name to output via the verboseMessageHandler, called once before logging begins
|
||||
/// \param targetName the desired target name to output in logs
|
||||
|
|
Loading…
Reference in a new issue