Another take at versioning details exchange - checkpoint

This commit is contained in:
Leonardo Murillo 2015-08-13 14:19:13 -06:00
parent 9308e9df4f
commit cda5b29fd3
13 changed files with 53 additions and 32 deletions

View file

@ -17,4 +17,5 @@ if (UNIX)
target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS}) target_link_libraries(${TARGET_NAME} ${CMAKE_DL_LIBS})
endif (UNIX) endif (UNIX)
include_application_version()
copy_dlls_beside_windows_executable() copy_dlls_beside_windows_executable()

View file

@ -129,6 +129,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
packetReceiver.registerListener(PacketType::CreateAssignment, this, "handleCreateAssignmentPacket"); packetReceiver.registerListener(PacketType::CreateAssignment, this, "handleCreateAssignmentPacket");
packetReceiver.registerListener(PacketType::StopNode, this, "handleStopNodePacket"); packetReceiver.registerListener(PacketType::StopNode, this, "handleStopNodePacket");
} }
void AssignmentClient::stopAssignmentClient() { void AssignmentClient::stopAssignmentClient() {
qDebug() << "Forced stop of assignment-client."; qDebug() << "Forced stop of assignment-client.";
@ -172,7 +173,6 @@ void AssignmentClient::aboutToQuit() {
qInstallMessageHandler(0); qInstallMessageHandler(0);
} }
void AssignmentClient::setUpStatusToMonitor() { void AssignmentClient::setUpStatusToMonitor() {
// send a stats packet every 1 seconds // send a stats packet every 1 seconds
connect(&_statsTimerACM, &QTimer::timeout, this, &AssignmentClient::sendStatusPacketToACM); connect(&_statsTimerACM, &QTimer::timeout, this, &AssignmentClient::sendStatusPacketToACM);
@ -217,7 +217,6 @@ void AssignmentClient::sendAssignmentRequest() {
qDebug() << "Failed to read local assignment server port from shared memory" qDebug() << "Failed to read local assignment server port from shared memory"
<< "- will send assignment request to previous assignment server socket."; << "- will send assignment request to previous assignment server socket.";
} }
} }
nodeList->sendAssignment(_requestAssignment); nodeList->sendAssignment(_requestAssignment);

View file

@ -12,6 +12,7 @@
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QThread> #include <QThread>
#include <ApplicationVersion.h>
#include <LogHandler.h> #include <LogHandler.h>
#include <SharedUtil.h> #include <SharedUtil.h>
#include <HifiConfigVariantMap.h> #include <HifiConfigVariantMap.h>
@ -40,6 +41,7 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
setOrganizationName("High Fidelity"); setOrganizationName("High Fidelity");
setOrganizationDomain("highfidelity.io"); setOrganizationDomain("highfidelity.io");
setApplicationName("assignment-client"); setApplicationName("assignment-client");
setApplicationName(BUILD_VERSION);
// use the verbose message handler in Logging // use the verbose message handler in Logging
qInstallMessageHandler(LogHandler::verboseMessageHandler); qInstallMessageHandler(LogHandler::verboseMessageHandler);
@ -93,10 +95,8 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
const QVariantMap argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments()); const QVariantMap argumentVariantMap = HifiConfigVariantMap::mergeCLParametersWithJSONConfig(arguments());
unsigned int numForks = 0; unsigned int numForks = 0;
if (parser.isSet(numChildsOption)) { if (parser.isSet(numChildsOption)) {
numForks = parser.value(numChildsOption).toInt(); numForks = parser.value(numChildsOption).toInt();
@ -139,7 +139,6 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
assignmentPool = parser.value(poolOption); assignmentPool = parser.value(poolOption);
} }
QUuid walletUUID; QUuid walletUUID;
if (argumentVariantMap.contains(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION)) { if (argumentVariantMap.contains(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION)) {
walletUUID = argumentVariantMap.value(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION).toString(); walletUUID = argumentVariantMap.value(ASSIGNMENT_WALLET_DESTINATION_ID_OPTION).toString();

View file

@ -1,11 +1,9 @@
// //
// InterfaceVersion.h // ApplicationVersion.h.in
// interface/src // cmake/macros
// //
// Created by Leonardo Murillo on 12/16/13. // Created by Leonardo Murillo on 8/13/15.
// Copyright 2013 High Fidelity, Inc. // Copyright 2015 High Fidelity, Inc.
//
// Declaration of version and build data
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html

View file

@ -0,0 +1,22 @@
#
# IncludeApplicationVersion.cmake
# cmake/macros
#
# Created by Leonardo Murillo on 07/14/2015.
# Copyright 2015 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
#
macro(INCLUDE_APPLICATION_VERSION)
if (DEFINED ENV{JOB_ID})
set (BUILD_SEQ $ENV{JOB_ID})
elseif (DEFINED ENV{ghprbPullId})
set (BUILD_SEQ "PR: $ENV{ghprbPullId} - Commit: $ENV{ghprbActualCommit}")
else ()
set(BUILD_SEQ "dev")
endif ()
configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${PROJECT_BINARY_DIR}/includes/ApplicationVersion.h")
include_directories("${PROJECT_BINARY_DIR}/includes")
endmacro(INCLUDE_APPLICATION_VERSION)

View file

@ -31,4 +31,5 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
# append OpenSSL to our list of libraries to link # append OpenSSL to our list of libraries to link
target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES})
include_application_version()
copy_dlls_beside_windows_executable() copy_dlls_beside_windows_executable()

View file

@ -24,6 +24,7 @@
#include <QUrlQuery> #include <QUrlQuery>
#include <AccountManager.h> #include <AccountManager.h>
#include <ApplicationVersion.h>
#include <HifiConfigVariantMap.h> #include <HifiConfigVariantMap.h>
#include <HTTPConnection.h> #include <HTTPConnection.h>
#include <JSONBreakableMarshal.h> #include <JSONBreakableMarshal.h>
@ -75,6 +76,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
setOrganizationName("High Fidelity"); setOrganizationName("High Fidelity");
setOrganizationDomain("highfidelity.io"); setOrganizationDomain("highfidelity.io");
setApplicationName("domain-server"); setApplicationName("domain-server");
setApplicationVersion(BUILD_VERSION);
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
// make sure we have a fresh AccountManager instance // make sure we have a fresh AccountManager instance
@ -1478,7 +1480,6 @@ const char JSON_KEY_POOL[] = "pool";
const char JSON_KEY_PENDING_CREDITS[] = "pending_credits"; const char JSON_KEY_PENDING_CREDITS[] = "pending_credits";
const char JSON_KEY_WAKE_TIMESTAMP[] = "wake_timestamp"; const char JSON_KEY_WAKE_TIMESTAMP[] = "wake_timestamp";
const char JSON_KEY_USERNAME[] = "username"; const char JSON_KEY_USERNAME[] = "username";
QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) { QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
QJsonObject nodeJson; QJsonObject nodeJson;
@ -1527,7 +1528,6 @@ QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
} }
const char ASSIGNMENT_SCRIPT_HOST_LOCATION[] = "resources/web/assignment"; const char ASSIGNMENT_SCRIPT_HOST_LOCATION[] = "resources/web/assignment";
QString pathForAssignmentScript(const QUuid& assignmentUUID) { QString pathForAssignmentScript(const QUuid& assignmentUUID) {
QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION); QString newPath(ASSIGNMENT_SCRIPT_HOST_LOCATION);
newPath += "/scripts/"; newPath += "/scripts/";
@ -1537,7 +1537,6 @@ QString pathForAssignmentScript(const QUuid& assignmentUUID) {
} }
const QString URI_OAUTH = "/oauth"; const QString URI_OAUTH = "/oauth";
bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool skipSubHandler) { bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, bool skipSubHandler) {
const QString JSON_MIME_TYPE = "application/json"; const QString JSON_MIME_TYPE = "application/json";
@ -2024,8 +2023,6 @@ bool DomainServer::isAuthenticatedRequest(HTTPConnection* connection, const QUrl
} }
const QString OAUTH_JSON_ACCESS_TOKEN_KEY = "access_token"; const QString OAUTH_JSON_ACCESS_TOKEN_KEY = "access_token";
QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenReply) { QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenReply) {
// pull the access token from the returned JSON and store it with the matching session UUID // pull the access token from the returned JSON and store it with the matching session UUID
QJsonDocument returnedJSON = QJsonDocument::fromJson(tokenReply->readAll()); QJsonDocument returnedJSON = QJsonDocument::fromJson(tokenReply->readAll());
@ -2042,7 +2039,6 @@ QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenR
} }
const QString DS_SETTINGS_SESSIONS_GROUP = "web-sessions"; const QString DS_SETTINGS_SESSIONS_GROUP = "web-sessions";
Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileReply) { Headers DomainServer::setupCookieHeadersFromProfileReply(QNetworkReply* profileReply) {
Headers cookieHeaders; Headers cookieHeaders;

View file

@ -14,20 +14,12 @@ endforeach()
find_package(Qt5LinguistTools REQUIRED) find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5LinguistToolsMacros) find_package(Qt5LinguistToolsMacros)
if (DEFINED ENV{JOB_ID})
set(BUILD_SEQ $ENV{JOB_ID})
elseif (DEFINED ENV{ghprbPullId})
set(BUILD_SEQ "PR: $ENV{ghprbPullId} - Commit: $ENV{ghprbActualCommit}")
else ()
set(BUILD_SEQ "dev")
endif ()
if (WIN32) if (WIN32)
add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h add_definitions(-D_USE_MATH_DEFINES) # apparently needed to get M_PI and other defines from cmath/math.h
add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines add_definitions(-DWINDOWS_LEAN_AND_MEAN) # needed to make sure windows doesn't go to crazy with its defines
endif() endif()
configure_file(InterfaceVersion.h.in "${PROJECT_BINARY_DIR}/includes/InterfaceVersion.h") include_application_version()
# grab the implementation and header files from src dirs # grab the implementation and header files from src dirs
file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h") file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h")
@ -174,7 +166,7 @@ if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE)
endif () endif ()
# include headers for interface and InterfaceConfig. # include headers for interface and InterfaceConfig.
include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes") include_directories("${PROJECT_SOURCE_DIR}/src")
target_link_libraries( target_link_libraries(
${TARGET_NAME} ${TARGET_NAME}

View file

@ -52,6 +52,7 @@
#include <AccountManager.h> #include <AccountManager.h>
#include <AddressManager.h> #include <AddressManager.h>
#include <ApplicationVersion.h>
#include <CursorManager.h> #include <CursorManager.h>
#include <AudioInjector.h> #include <AudioInjector.h>
#include <AutoUpdater.h> #include <AutoUpdater.h>
@ -100,7 +101,6 @@
#include "AudioClient.h" #include "AudioClient.h"
#include "DiscoverabilityManager.h" #include "DiscoverabilityManager.h"
#include "GLCanvas.h" #include "GLCanvas.h"
#include "InterfaceVersion.h"
#include "LODManager.h" #include "LODManager.h"
#include "Menu.h" #include "Menu.h"
#include "ModelPackager.h" #include "ModelPackager.h"

View file

@ -28,4 +28,5 @@ include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}")
target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES}) target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES} ${TBB_LIBRARIES})
# append tbb includes to our list of includes to bubble # append tbb includes to our list of includes to bubble
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS}) target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${TBB_INCLUDE_DIRS})
include_application_version()

View file

@ -66,7 +66,9 @@ Assignment::Assignment(NLPacket& packet) :
_payload(), _payload(),
_walletUUID() _walletUUID()
{ {
qDebug() << "LEOTEST: We are building an Assignment from a packet";
if (packet.getType() == PacketType::RequestAssignment) { if (packet.getType() == PacketType::RequestAssignment) {
qDebug() << "LEOTEST: This is a request assignment packet";
_command = Assignment::RequestCommand; _command = Assignment::RequestCommand;
} else if (packet.getType() == PacketType::CreateAssignment) { } else if (packet.getType() == PacketType::CreateAssignment) {
_command = Assignment::CreateCommand; _command = Assignment::CreateCommand;
@ -151,11 +153,16 @@ QDataStream& operator<<(QDataStream &out, const Assignment& assignment) {
QDataStream& operator>>(QDataStream &in, Assignment& assignment) { QDataStream& operator>>(QDataStream &in, Assignment& assignment) {
quint8 packedType; quint8 packedType;
in >> packedType; in >> packedType;
if (assignment._command == Assignment::RequestCommand) {
qDebug() << "We are extracting the version";
in >> assignment._nodeVersion;
}
assignment._type = (Assignment::Type) packedType; assignment._type = (Assignment::Type) packedType;
in >> assignment._uuid >> assignment._pool >> assignment._payload; in >> assignment._uuid >> assignment._pool >> assignment._payload;
if (assignment._command == Assignment::RequestCommand) { if (assignment._command == Assignment::RequestCommand) {
qDebug() << "LEOTEST: Operator for >> in case of RequestCommand";
in >> assignment._walletUUID; in >> assignment._walletUUID;
} }

View file

@ -98,6 +98,7 @@ protected:
QByteArray _payload; /// an optional payload attached to this assignment, a maximum for 1024 bytes will be packed QByteArray _payload; /// an optional payload attached to this assignment, a maximum for 1024 bytes will be packed
bool _isStatic; /// defines if this assignment needs to be re-queued in the domain-server if it stops being fulfilled bool _isStatic; /// defines if this assignment needs to be re-queued in the domain-server if it stops being fulfilled
QUuid _walletUUID; /// the UUID for the wallet that should be paid for this assignment QUuid _walletUUID; /// the UUID for the wallet that should be paid for this assignment
QString _nodeVersion;
}; };
#endif // hifi_Assignment_h #endif // hifi_Assignment_h

View file

@ -17,6 +17,7 @@
#include <QtCore/QThread> #include <QtCore/QThread>
#include <QtNetwork/QHostInfo> #include <QtNetwork/QHostInfo>
#include <ApplicationVersion.h>
#include <LogHandler.h> #include <LogHandler.h>
#include "AccountManager.h" #include "AccountManager.h"
@ -367,7 +368,6 @@ void NodeList::sendDSPathQuery(const QString& newPath) {
} }
} }
void NodeList::processDomainServerPathResponse(QSharedPointer<NLPacket> packet) { void NodeList::processDomainServerPathResponse(QSharedPointer<NLPacket> packet) {
// This is a response to a path query we theoretically made. // This is a response to a path query we theoretically made.
// In the future we may want to check that this was actually from our DS and for a query we actually made. // In the future we may want to check that this was actually from our DS and for a query we actually made.
@ -457,7 +457,6 @@ void NodeList::pingPunchForDomainServer() {
} }
} }
void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<NLPacket> packet) { void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<NLPacket> packet) {
if (_domainHandler.getSockAddr().isNull()) { if (_domainHandler.getSockAddr().isNull()) {
// refuse to process this packet if we aren't currently connected to the DS // refuse to process this packet if we aren't currently connected to the DS
@ -547,9 +546,14 @@ void NodeList::sendAssignment(Assignment& assignment) {
? PacketType::CreateAssignment ? PacketType::CreateAssignment
: PacketType::RequestAssignment; : PacketType::RequestAssignment;
qDebug() << "LEOTEST: Packet type name " << nameForPacketType(assignmentPacketType);
auto assignmentPacket = NLPacket::create(assignmentPacketType); auto assignmentPacket = NLPacket::create(assignmentPacketType);
QDataStream packetStream(assignmentPacket.get()); QDataStream packetStream(assignmentPacket.get());
if (assignmentPacketType == PacketType::RequestAssignment) {
qDebug() << "LEOTEST: This is an assignment request, lets send the node version here " << BUILD_VERSION;
packetStream << BUILD_VERSION;
}
packetStream << assignment; packetStream << assignment;
// TODO: should this be a non sourced packet? // TODO: should this be a non sourced packet?