Merge pull request #5565 from murillodigital/node-version

DO NOT MERGE - Node versioning
This commit is contained in:
Stephen Birarda 2015-08-19 13:32:48 -07:00
commit 42a7262707
17 changed files with 83 additions and 42 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

@ -9,6 +9,7 @@
<thead> <thead>
<tr> <tr>
<th>Type</th> <th>Type</th>
<th>Version</th>
<th>UUID</th> <th>UUID</th>
<th>Pool</th> <th>Pool</th>
<th>Username</th> <th>Username</th>
@ -24,6 +25,7 @@
<% _.each(nodes, function(node, node_index){ %> <% _.each(nodes, function(node, node_index){ %>
<tr> <tr>
<td><%- node.type %></td> <td><%- node.type %></td>
<td><%- node.version %></td>
<td><a href="stats/?uuid=<%- node.uuid %>"><%- node.uuid %></a></td> <td><a href="stats/?uuid=<%- node.uuid %>"><%- node.uuid %></a></td>
<td><%- node.pool %></td> <td><%- node.pool %></td>
<td><%- node.username %></td> <td><%- node.username %></td>
@ -75,4 +77,4 @@
<!--#include file="footer.html"--> <!--#include file="footer.html"-->
<script src='js/underscore-min.js'></script> <script src='js/underscore-min.js'></script>
<script src='js/tables.js'></script> <script src='js/tables.js'></script>
<!--#include file="page-end.html"--> <!--#include file="page-end.html"-->

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
@ -738,6 +740,7 @@ void DomainServer::processConnectRequestPacket(QSharedPointer<NLPacket> packet)
if (isAssignment) { if (isAssignment) {
nodeData->setAssignmentUUID(matchingQueuedAssignment->getUUID()); nodeData->setAssignmentUUID(matchingQueuedAssignment->getUUID());
nodeData->setWalletUUID(pendingAssigneeData->getWalletUUID()); nodeData->setWalletUUID(pendingAssigneeData->getWalletUUID());
nodeData->setNodeVersion(pendingAssigneeData->getNodeVersion());
// always allow assignment clients to create and destroy entities // always allow assignment clients to create and destroy entities
newNode->setCanAdjustLocks(true); newNode->setCanAdjustLocks(true);
@ -1168,7 +1171,8 @@ void DomainServer::processRequestAssignmentPacket(QSharedPointer<NLPacket> packe
// add the information for that deployed assignment to the hash of pending assigned nodes // add the information for that deployed assignment to the hash of pending assigned nodes
PendingAssignedNodeData* pendingNodeData = new PendingAssignedNodeData(assignmentToDeploy->getUUID(), PendingAssignedNodeData* pendingNodeData = new PendingAssignedNodeData(assignmentToDeploy->getUUID(),
requestAssignment.getWalletUUID()); requestAssignment.getWalletUUID(),
requestAssignment.getNodeVersion());
_pendingAssignedNodes.insert(uniqueAssignment.getUUID(), pendingNodeData); _pendingAssignedNodes.insert(uniqueAssignment.getUUID(), pendingNodeData);
} else { } else {
if (requestAssignment.getType() != Assignment::AgentType if (requestAssignment.getType() != Assignment::AgentType
@ -1478,7 +1482,7 @@ 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";
const char JSON_KEY_VERSION[] = "version";
QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) { QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
QJsonObject nodeJson; QJsonObject nodeJson;
@ -1505,6 +1509,7 @@ QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
// add the node username, if it exists // add the node username, if it exists
nodeJson[JSON_KEY_USERNAME] = nodeData->getUsername(); nodeJson[JSON_KEY_USERNAME] = nodeData->getUsername();
nodeJson[JSON_KEY_VERSION] = nodeData->getNodeVersion();
SharedAssignmentPointer matchingAssignment = _allAssignments.value(nodeData->getAssignmentUUID()); SharedAssignmentPointer matchingAssignment = _allAssignments.value(nodeData->getAssignmentUUID());
if (matchingAssignment) { if (matchingAssignment) {
@ -1527,7 +1532,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 +1541,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 +2027,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 +2043,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

@ -50,6 +50,10 @@ public:
const NodeSet& getNodeInterestSet() const { return _nodeInterestSet; } const NodeSet& getNodeInterestSet() const { return _nodeInterestSet; }
void setNodeInterestSet(const NodeSet& nodeInterestSet) { _nodeInterestSet = nodeInterestSet; } void setNodeInterestSet(const NodeSet& nodeInterestSet) { _nodeInterestSet = nodeInterestSet; }
void setNodeVersion(const QString& nodeVersion) { _nodeVersion = nodeVersion; }
const QString& getNodeVersion() { return _nodeVersion; }
private: private:
QJsonObject mergeJSONStatsFromNewObject(const QJsonObject& newObject, QJsonObject destinationObject); QJsonObject mergeJSONStatsFromNewObject(const QJsonObject& newObject, QJsonObject destinationObject);
@ -62,6 +66,7 @@ private:
HifiSockAddr _sendingSockAddr; HifiSockAddr _sendingSockAddr;
bool _isAuthenticated; bool _isAuthenticated;
NodeSet _nodeInterestSet; NodeSet _nodeInterestSet;
QString _nodeVersion;
}; };
#endif // hifi_DomainServerNodeData_h #endif // hifi_DomainServerNodeData_h

View file

@ -11,9 +11,10 @@
#include "PendingAssignedNodeData.h" #include "PendingAssignedNodeData.h"
PendingAssignedNodeData::PendingAssignedNodeData(const QUuid& assignmentUUID, const QUuid& walletUUID) : PendingAssignedNodeData::PendingAssignedNodeData(const QUuid& assignmentUUID, const QUuid& walletUUID, const QString& nodeVersion) :
_assignmentUUID(assignmentUUID), _assignmentUUID(assignmentUUID),
_walletUUID(walletUUID) _walletUUID(walletUUID),
_nodeVersion(nodeVersion)
{ {
} }

View file

@ -18,16 +18,20 @@
class PendingAssignedNodeData : public QObject { class PendingAssignedNodeData : public QObject {
Q_OBJECT Q_OBJECT
public: public:
PendingAssignedNodeData(const QUuid& assignmentUUID, const QUuid& walletUUID); PendingAssignedNodeData(const QUuid& assignmentUUID, const QUuid& walletUUID, const QString& nodeVersion);
void setAssignmentUUID(const QUuid& assignmentUUID) { _assignmentUUID = assignmentUUID; } void setAssignmentUUID(const QUuid& assignmentUUID) { _assignmentUUID = assignmentUUID; }
const QUuid& getAssignmentUUID() const { return _assignmentUUID; } const QUuid& getAssignmentUUID() const { return _assignmentUUID; }
void setWalletUUID(const QUuid& walletUUID) { _walletUUID = walletUUID; } void setWalletUUID(const QUuid& walletUUID) { _walletUUID = walletUUID; }
const QUuid& getWalletUUID() const { return _walletUUID; } const QUuid& getWalletUUID() const { return _walletUUID; }
const QString& getNodeVersion() const { return _nodeVersion; }
private: private:
QUuid _assignmentUUID; QUuid _assignmentUUID;
QUuid _walletUUID; QUuid _walletUUID;
QString _nodeVersion;
}; };
#endif // hifi_PendingAssignedNodeData_h #endif // hifi_PendingAssignedNodeData_h

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>
@ -103,7 +104,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

@ -15,6 +15,7 @@
#include <QtCore/QDataStream> #include <QtCore/QDataStream>
#include <ApplicationVersion.h>
#include "Assignment.h" #include "Assignment.h"
Assignment::Type Assignment::typeForNodeType(NodeType_t nodeType) { Assignment::Type Assignment::typeForNodeType(NodeType_t nodeType) {
@ -52,11 +53,14 @@ Assignment::Assignment(Assignment::Command command, Assignment::Type type, const
_location(location), _location(location),
_payload(), _payload(),
_isStatic(false), _isStatic(false),
_walletUUID() _walletUUID(),
_nodeVersion()
{ {
if (_command == Assignment::CreateCommand) { if (_command == Assignment::CreateCommand) {
// this is a newly created assignment, generate a random UUID // this is a newly created assignment, generate a random UUID
_uuid = QUuid::createUuid(); _uuid = QUuid::createUuid();
} else if (_command == Assignment::RequestCommand) {
_nodeVersion = BUILD_VERSION;
} }
} }
@ -64,7 +68,8 @@ Assignment::Assignment(NLPacket& packet) :
_pool(), _pool(),
_location(GlobalLocation), _location(GlobalLocation),
_payload(), _payload(),
_walletUUID() _walletUUID(),
_nodeVersion()
{ {
if (packet.getType() == PacketType::RequestAssignment) { if (packet.getType() == PacketType::RequestAssignment) {
_command = Assignment::RequestCommand; _command = Assignment::RequestCommand;
@ -83,15 +88,14 @@ Assignment::Assignment(NLPacket& packet) :
Assignment::Assignment(const Assignment& otherAssignment) { Assignment::Assignment(const Assignment& otherAssignment) {
_uuid = otherAssignment._uuid; _uuid = otherAssignment._uuid;
_command = otherAssignment._command; _command = otherAssignment._command;
_type = otherAssignment._type; _type = otherAssignment._type;
_location = otherAssignment._location; _location = otherAssignment._location;
_pool = otherAssignment._pool; _pool = otherAssignment._pool;
_payload = otherAssignment._payload; _payload = otherAssignment._payload;
_walletUUID = otherAssignment._walletUUID; _walletUUID = otherAssignment._walletUUID;
_nodeVersion = otherAssignment._nodeVersion;
} }
Assignment& Assignment::operator=(const Assignment& rhsAssignment) { Assignment& Assignment::operator=(const Assignment& rhsAssignment) {
@ -110,6 +114,7 @@ void Assignment::swap(Assignment& otherAssignment) {
swap(_pool, otherAssignment._pool); swap(_pool, otherAssignment._pool);
swap(_payload, otherAssignment._payload); swap(_payload, otherAssignment._payload);
swap(_walletUUID, otherAssignment._walletUUID); swap(_walletUUID, otherAssignment._walletUUID);
swap(_nodeVersion, otherAssignment._nodeVersion);
} }
const char* Assignment::getTypeName() const { const char* Assignment::getTypeName() const {
@ -139,7 +144,13 @@ QDebug operator<<(QDebug debug, const Assignment &assignment) {
} }
QDataStream& operator<<(QDataStream &out, const Assignment& assignment) { QDataStream& operator<<(QDataStream &out, const Assignment& assignment) {
out << (quint8) assignment._type << assignment._uuid << assignment._pool << assignment._payload; out << (quint8) assignment._type;
if (assignment._command == Assignment::RequestCommand) {
out << assignment._nodeVersion;
}
out << assignment._uuid << assignment._pool << assignment._payload;
if (assignment._command == Assignment::RequestCommand) { if (assignment._command == Assignment::RequestCommand) {
out << assignment._walletUUID; out << assignment._walletUUID;
@ -151,6 +162,9 @@ 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) {
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;

View file

@ -83,6 +83,8 @@ public:
void setWalletUUID(const QUuid& walletUUID) { _walletUUID = walletUUID; } void setWalletUUID(const QUuid& walletUUID) { _walletUUID = walletUUID; }
const QUuid& getWalletUUID() const { return _walletUUID; } const QUuid& getWalletUUID() const { return _walletUUID; }
const QString& getNodeVersion() const { return _nodeVersion; }
const char* getTypeName() const; const char* getTypeName() const;
friend QDebug operator<<(QDebug debug, const Assignment& assignment); friend QDebug operator<<(QDebug debug, const Assignment& assignment);
@ -98,6 +100,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
@ -548,7 +547,7 @@ void NodeList::sendAssignment(Assignment& assignment) {
: PacketType::RequestAssignment; : PacketType::RequestAssignment;
auto assignmentPacket = NLPacket::create(assignmentPacketType); auto assignmentPacket = NLPacket::create(assignmentPacketType);
QDataStream packetStream(assignmentPacket.get()); QDataStream packetStream(assignmentPacket.get());
packetStream << assignment; packetStream << assignment;