Revert "Update assignment client to close on WM_CLOSE message on Windows"

This commit is contained in:
Leonardo Murillo 2014-09-05 11:36:56 -06:00
parent c4baf86f9d
commit a603453cf2
8 changed files with 1 additions and 127 deletions

View file

@ -17,7 +17,6 @@
#include <Assignment.h>
#include <HifiConfigVariantMap.h>
#include <Logging.h>
#include <LogUtils.h>
#include <NodeList.h>
#include <PacketHeaders.h>
#include <SharedUtil.h>
@ -37,19 +36,13 @@ int hifiSockAddrMeta = qRegisterMetaType<HifiSockAddr>("HifiSockAddr");
AssignmentClient::AssignmentClient(int &argc, char **argv) :
QCoreApplication(argc, argv),
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME),
_shutdownEventListener(this)
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME)
{
LogUtils::init();
setOrganizationName("High Fidelity");
setOrganizationDomain("highfidelity.io");
setApplicationName("assignment-client");
QSettings::setDefaultFormat(QSettings::IniFormat);
installNativeEventFilter(&_shutdownEventListener);
connect(&_shutdownEventListener, SIGNAL(receivedCloseEvent()), SLOT(quit()));
// set the logging target to the the CHILD_TARGET_NAME
Logging::setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME);

View file

@ -14,7 +14,6 @@
#include <QtCore/QCoreApplication>
#include "ShutdownEventListener.h"
#include "ThreadedAssignment.h"
class AssignmentClient : public QCoreApplication {
@ -22,7 +21,6 @@ class AssignmentClient : public QCoreApplication {
public:
AssignmentClient(int &argc, char **argv);
static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; }
private slots:
void sendAssignmentRequest();
void readPendingDatagrams();
@ -32,7 +30,6 @@ private slots:
private:
Assignment _requestAssignment;
static SharedAssignmentPointer _currentAssignment;
ShutdownEventListener _shutdownEventListener;
QString _assignmentServerHostname;
};

View file

@ -21,7 +21,6 @@
#include <AccountManager.h>
#include <HifiConfigVariantMap.h>
#include <HTTPConnection.h>
#include <LogUtils.h>
#include <PacketHeaders.h>
#include <SharedUtil.h>
#include <UUID.h>
@ -32,7 +31,6 @@
DomainServer::DomainServer(int argc, char* argv[]) :
QCoreApplication(argc, argv),
_shutdownEventListener(this),
_httpManager(DOMAIN_SERVER_HTTP_PORT, QString("%1/resources/web/").arg(QCoreApplication::applicationDirPath()), this),
_httpsManager(NULL),
_allAssignments(),
@ -48,16 +46,10 @@ DomainServer::DomainServer(int argc, char* argv[]) :
_cookieSessionHash(),
_settingsManager()
{
LogUtils::init();
setOrganizationName("High Fidelity");
setOrganizationDomain("highfidelity.io");
setApplicationName("domain-server");
QSettings::setDefaultFormat(QSettings::IniFormat);
installNativeEventFilter(&_shutdownEventListener);
connect(&_shutdownEventListener, SIGNAL(receivedCloseEvent()), SLOT(quit()));
qRegisterMetaType<DomainServerWebSessionData>("DomainServerWebSessionData");
qRegisterMetaTypeStreamOperators<DomainServerWebSessionData>("DomainServerWebSessionData");

View file

@ -19,7 +19,6 @@
#include <QtCore/QSharedPointer>
#include <QtCore/QStringList>
#include <QtCore/QUrl>
#include <QAbstractNativeEventFilter>
#include <Assignment.h>
#include <HTTPSConnection.h>
@ -27,7 +26,6 @@
#include "DomainServerSettingsManager.h"
#include "DomainServerWebSessionData.h"
#include "ShutdownEventListener.h"
#include "WalletTransaction.h"
#include "PendingAssignedNodeData.h"
@ -99,8 +97,6 @@ private:
QJsonObject jsonForSocket(const HifiSockAddr& socket);
QJsonObject jsonObjectForNode(const SharedNodePointer& node);
ShutdownEventListener _shutdownEventListener;
HTTPManager _httpManager;
HTTPSManager* _httpsManager;

View file

@ -1,24 +0,0 @@
//
// LogUtils.cpp
// libraries/shared/src
//
// Created by Ryan Huffman on 09/03/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "LogUtils.h"
void LogUtils::init() {
#ifdef Q_OS_WIN
// Windows applications buffer stdout/err hard when not run from a terminal,
// making assignment clients run from the Stack Manager application not flush
// log messages.
// This will disable the buffering. If this becomes a performance issue,
// an alternative is to call fflush(...) periodically.
setbuf(stdout, NULL);
setbuf(stderr, NULL);
#endif
}

View file

@ -1,20 +0,0 @@
//
// LogUtils.h
// libraries/shared/src
//
// Created by Ryan Huffman on 09/03/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_LogUtils_h
#define hifi_LogUtils_h
class LogUtils {
public:
static void init();
};
#endif // hifi_LogUtils_h

View file

@ -1,31 +0,0 @@
//
// ShutdownEventListener.cpp
// libraries/shared/src
//
// Created by Ryan Huffman on 09/03/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "ShutdownEventListener.h"
#ifdef Q_OS_WIN
#include <Windows.h>
#endif
ShutdownEventListener::ShutdownEventListener(QObject* parent) : QObject(parent) {
}
bool ShutdownEventListener::nativeEventFilter(const QByteArray &eventType, void* msg, long* result) {
#ifdef Q_OS_WIN
if (eventType == "windows_generic_MSG") {
MSG* message = (MSG*)msg;
if (message->message == WM_CLOSE) {
emit receivedCloseEvent();
}
}
#endif
return true;
}

View file

@ -1,29 +0,0 @@
//
// ShutdownEventListener.h
// libraries/shared/src
//
// Created by Ryan Huffman on 09/03/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_ShutdownEventListener_h
#define hifi_ShutdownEventListener_h
#include <QObject>
#include <QAbstractNativeEventFilter>
class ShutdownEventListener : public QObject, public QAbstractNativeEventFilter {
Q_OBJECT
public:
ShutdownEventListener(QObject* parent = NULL);
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long* result);
signals:
void receivedCloseEvent();
};
#endif // hifi_ShutdownEventListener_h