Modified AC logging for paging requirements

This commit is contained in:
Simon Walton 2019-10-07 17:35:14 -07:00
parent 3db915c432
commit f73a7c0883
3 changed files with 23 additions and 11 deletions

View file

@ -82,6 +82,9 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
}
_assignmentServerSocket = HifiSockAddr(_assignmentServerHostname, assignmentServerPort, true);
if (_assignmentServerSocket.isNull()) {
qCCritical(assignment_client) << "PAGE: Couldn't resolve domain server address" << _assignmentServerHostname;
}
_assignmentServerSocket.setObjectName("AssignmentServer");
nodeList->setAssignmentServerSocket(_assignmentServerSocket);
@ -183,16 +186,21 @@ void AssignmentClient::sendAssignmentRequest() {
// we want to check again for the local domain-server port in case the DS has restarted
quint16 localAssignmentServerPort;
if (nodeList->getLocalServerPortFromSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, localAssignmentServerPort)) {
if (localAssignmentServerPort != _assignmentServerSocket.getPort()) {
qCDebug(assignment_client) << "Port for local assignment server read from shared memory is"
<< localAssignmentServerPort;
if (localAssignmentServerPort == 0) {
qCWarning(assignment_client) << "ALERT: Server port from shared memory is 0";
} else {
if (localAssignmentServerPort != _assignmentServerSocket.getPort()) {
qCDebug(assignment_client) << "Port for local assignment server read from shared memory is"
<< localAssignmentServerPort;
_assignmentServerSocket.setPort(localAssignmentServerPort);
nodeList->setAssignmentServerSocket(_assignmentServerSocket);
_assignmentServerSocket.setPort(localAssignmentServerPort);
nodeList->setAssignmentServerSocket(_assignmentServerSocket);
}
}
} else {
qCWarning(assignment_client) << "Failed to read local assignment server port from shared memory"
<< "- will send assignment request to previous assignment server socket.";
qCWarning(assignment_client) << "ALERT: Failed to read local assignment server port from shared memory ("
<< DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY
<< ")- will send assignment request to previous assignment server socket.";
}
}
@ -250,7 +258,7 @@ void AssignmentClient::handleCreateAssignmentPacket(QSharedPointer<ReceivedMessa
// Starts an event loop, and emits workerThread->started()
workerThread->start();
} else {
qCWarning(assignment_client) << "Received an assignment that could not be unpacked. Re-requesting.";
qCWarning(assignment_client) << "ALERT: Received an assignment that could not be unpacked. Re-requesting.";
}
}

View file

@ -24,7 +24,9 @@
ThreadedAssignment* AssignmentFactory::unpackAssignment(ReceivedMessage& message) {
quint8 packedType;
message.peekPrimitive(&packedType);
if (message.readPrimitive(&packedType) != sizeof(packedType)) {
return nullptr;
}
Assignment::Type unpackedType = (Assignment::Type) packedType;

View file

@ -1329,7 +1329,8 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p
qCDebug(networking) << "Wrote local listening port" << localPort << "to shared memory at key" << key;
} else {
qWarning() << "ALERT: Failed to create and attach to shared memory to share local port with assignment-client children.";
qWarning() << "ALERT: Failed to create and attach to shared memory to share local port with assignment-client children:"
<< sharedPortMem->errorString();
}
}
@ -1337,7 +1338,8 @@ void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* p
bool LimitedNodeList::getLocalServerPortFromSharedMemory(const QString key, quint16& localPort) {
QSharedMemory sharedMem(key);
if (!sharedMem.attach(QSharedMemory::ReadOnly)) {
qCWarning(networking) << "Could not attach to shared memory at key" << key;
qCWarning(networking) << "Could not attach to shared memory at key" << key
<< ":" << sharedMem.errorString();
return false;
} else {
sharedMem.lock();