This commit is contained in:
Seth Alves 2015-04-29 15:30:13 -07:00
parent 009bb9dc71
commit e985f56b12
11 changed files with 3 additions and 47 deletions

View file

@ -117,18 +117,14 @@ void AssignmentClient::stopAssignmentClient() {
if (_currentAssignment) { if (_currentAssignment) {
_currentAssignment->aboutToQuit(); _currentAssignment->aboutToQuit();
QThread* currentAssignmentThread = _currentAssignment->thread(); QThread* currentAssignmentThread = _currentAssignment->thread();
qDebug() << "main thread waiting on _currentAssignment->thread()" << currentAssignmentThread->objectName();
currentAssignmentThread->quit(); currentAssignmentThread->quit();
currentAssignmentThread->wait(); currentAssignmentThread->wait();
qDebug() << "done waiting.";
} }
} }
void AssignmentClient::aboutToQuit() { void AssignmentClient::aboutToQuit() {
qDebug() << "AssignmentClient::aboutToQuit start";
stopAssignmentClient(); stopAssignmentClient();
qDebug() << "AssignmentClient::aboutToQuit end";
// clear the log handler so that Qt doesn't call the destructor on LogHandler // clear the log handler so that Qt doesn't call the destructor on LogHandler
qInstallMessageHandler(0); qInstallMessageHandler(0);
// clear out pointer to the assignment so the destructor gets called. if we don't do this here, // clear out pointer to the assignment so the destructor gets called. if we don't do this here,

View file

@ -167,6 +167,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
} }
if (parser.isSet(numChildsOption)) { if (parser.isSet(numChildsOption)) {
if (minForks && minForks > numForks) { if (minForks && minForks > numForks) {
qCritical() << "--min can't be more than -n"; qCritical() << "--min can't be more than -n";

View file

@ -74,7 +74,6 @@ public:
NodeToSenderStatsMap& getSingleSenderStats() { return _singleSenderStats; } NodeToSenderStatsMap& getSingleSenderStats() { return _singleSenderStats; }
// void shuttingDown() { _shuttingDown = true;}
virtual void terminating() { _shuttingDown = true; ReceivedPacketProcessor::terminating(); } virtual void terminating() { _shuttingDown = true; ReceivedPacketProcessor::terminating(); }
protected: protected:

View file

@ -239,10 +239,8 @@ OctreeServer::OctreeServer(const QByteArray& packet) :
_octreeInboundPacketProcessor(NULL), _octreeInboundPacketProcessor(NULL),
_persistThread(NULL), _persistThread(NULL),
_started(time(0)), _started(time(0)),
_startedUSecs(usecTimestampNow()), _startedUSecs(usecTimestampNow())
_nodeList(DependencyManager::get<NodeList>())
{ {
if (_instance) { if (_instance) {
qDebug() << "Octree Server starting... while old instance still running _instance=["<<_instance<<"] this=[" << this << "]"; qDebug() << "Octree Server starting... while old instance still running _instance=["<<_instance<<"] this=[" << this << "]";
} }
@ -1100,8 +1098,6 @@ void OctreeServer::readConfiguration() {
} }
void OctreeServer::run() { void OctreeServer::run() {
// qInstallMessageHandler(LogHandler::verboseMessageHandler);
_safeServerName = getMyServerName(); _safeServerName = getMyServerName();
// Before we do anything else, create our tree... // Before we do anything else, create our tree...

View file

@ -238,9 +238,6 @@ protected:
static QMutex _threadsDidPacketDistributorMutex; static QMutex _threadsDidPacketDistributorMutex;
static QMutex _threadsDidHandlePacketSendMutex; static QMutex _threadsDidHandlePacketSendMutex;
static QMutex _threadsDidCallWriteDatagramMutex; 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 #endif // hifi_OctreeServer_h

View file

@ -222,10 +222,6 @@ protected:
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton 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 void operator=(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
virtual ~LimitedNodeList() {
qDebug() << "XXXXXXXXXXXXXXXXXXXX ~LimitedNodeList called";
}
qint64 writeDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr, qint64 writeDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr,
const QUuid& connectionSecret); const QUuid& connectionSecret);

View file

@ -45,11 +45,6 @@ class NodeList : public LimitedNodeList {
SINGLETON_DEPENDENCY SINGLETON_DEPENDENCY
public: public:
virtual ~NodeList() {
qDebug() << "XXXXXXXXXXXXXXXXXXXX ~NodeList called";
}
NodeType_t getOwnerType() const { return _ownerType; } NodeType_t getOwnerType() const { return _ownerType; }
void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; } void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; }

View file

@ -26,14 +26,7 @@ ThreadedAssignment::ThreadedAssignment(const QByteArray& packet) :
} }
ThreadedAssignment::~ThreadedAssignment() {
// setFinished(true);
}
void ThreadedAssignment::setFinished(bool isFinished) { void ThreadedAssignment::setFinished(bool isFinished) {
qDebug() << "------------- ThreadedAssignment::setFinished" << isFinished << " -------------------";
_isFinished = isFinished; _isFinished = isFinished;
if (_isFinished) { if (_isFinished) {
@ -57,10 +50,8 @@ void ThreadedAssignment::setFinished(bool isFinished) {
if (_datagramProcessingThread) { if (_datagramProcessingThread) {
// tell the datagram processing thread to quit and wait until it is done, then return the node socket to the NodeList // tell the datagram processing thread to quit and wait until it is done, then return the node socket to the NodeList
qDebug() << "stopping datagramProcessingThread...";
_datagramProcessingThread->quit(); _datagramProcessingThread->quit();
_datagramProcessingThread->wait(); _datagramProcessingThread->wait();
qDebug() << "done stopping datagramProcessingThread.";
// set node socket parent back to NodeList // set node socket parent back to NodeList
nodeList->getNodeSocket().setParent(nodeList.data()); nodeList->getNodeSocket().setParent(nodeList.data());

View file

@ -20,7 +20,6 @@ class ThreadedAssignment : public Assignment {
Q_OBJECT Q_OBJECT
public: public:
ThreadedAssignment(const QByteArray& packet); ThreadedAssignment(const QByteArray& packet);
virtual ~ThreadedAssignment();
void setFinished(bool isFinished); void setFinished(bool isFinished);
virtual void aboutToFinish() { }; virtual void aboutToFinish() { };

View file

@ -26,12 +26,9 @@
class Dependency { class Dependency {
public: public:
typedef std::function<void(Dependency* pointer)> DeleterFunction; typedef std::function<void(Dependency* pointer)> DeleterFunction;
const QString& getDependencyName() { return _name; }
protected: protected:
virtual ~Dependency() { virtual ~Dependency() {}
qDebug() << "DESTRUCTING" << _name;
}
virtual void customDeleter() { virtual void customDeleter() {
_customDeleter(this); _customDeleter(this);
} }
@ -39,9 +36,6 @@ protected:
void setCustomDeleter(DeleterFunction customDeleter) { _customDeleter = customDeleter; } void setCustomDeleter(DeleterFunction customDeleter) { _customDeleter = customDeleter; }
DeleterFunction _customDeleter = [](Dependency* pointer) { delete pointer; }; DeleterFunction _customDeleter = [](Dependency* pointer) { delete pointer; };
void setDependencyName(QString name) { _name = name; }
QString _name;
friend class DependencyManager; friend class DependencyManager;
}; };
@ -101,7 +95,6 @@ QSharedPointer<T> DependencyManager::set(Args&&... args) {
QSharedPointer<T> newInstance(new T(args...), &T::customDeleter); QSharedPointer<T> newInstance(new T(args...), &T::customDeleter);
QSharedPointer<Dependency> storedInstance = qSharedPointerCast<Dependency>(newInstance); QSharedPointer<Dependency> storedInstance = qSharedPointerCast<Dependency>(newInstance);
instance.swap(storedInstance); instance.swap(storedInstance);
newInstance->setDependencyName(typeid(T).name());
return newInstance; return newInstance;
} }
@ -109,7 +102,6 @@ QSharedPointer<T> DependencyManager::set(Args&&... args) {
template <typename T> template <typename T>
void DependencyManager::destroy() { void DependencyManager::destroy() {
static size_t hashCode = _manager.getHashCode<T>(); static size_t hashCode = _manager.getHashCode<T>();
qDebug() << "DESTROYING" << _manager.safeGet(hashCode)->getDependencyName();
_manager.safeGet(hashCode).clear(); _manager.safeGet(hashCode).clear();
} }

View file

@ -19,8 +19,6 @@
#include <qset.h> #include <qset.h>
#include <qstring.h> #include <qstring.h>
#include <iostream>
const int VERBOSE_LOG_INTERVAL_SECONDS = 5; const int VERBOSE_LOG_INTERVAL_SECONDS = 5;
enum LogMsgType { enum LogMsgType {
@ -37,10 +35,6 @@ class LogHandler : public QObject {
public: public:
static LogHandler& getInstance(); static LogHandler& getInstance();
virtual ~LogHandler() {
std::cerr << "XXXXXXXX ~LogHandler()\n";
}
/// sets the target name to output via the verboseMessageHandler, called once before logging begins /// sets the target name to output via the verboseMessageHandler, called once before logging begins
/// \param targetName the desired target name to output in logs /// \param targetName the desired target name to output in logs
void setTargetName(const QString& targetName) { _targetName = targetName; } void setTargetName(const QString& targetName) { _targetName = targetName; }