Premake: Add "--disable-node-log" to disable logging of Nodes activity.
This commit is contained in:
parent
41292eee95
commit
9fdf7b9b38
@ -57,6 +57,10 @@ newoption {
|
||||
trigger = "disable-bitmessage",
|
||||
description = "Disable use of BitMessage completely."
|
||||
}
|
||||
newoption {
|
||||
trigger = "disable-node-log",
|
||||
description = "Disable debugging messages for Nodes in Debug builds."
|
||||
}
|
||||
newoption {
|
||||
trigger = "disable-base128",
|
||||
description = "Disable debugging messages for Nodes in Debug builds."
|
||||
@ -289,6 +293,9 @@ workspace "iw4x"
|
||||
"./src/Components/Modules/BitMessage.*",
|
||||
}
|
||||
end
|
||||
if _OPTIONS["disable-node-log"] then
|
||||
defines { "DISABLE_NODE_LOG"}
|
||||
end
|
||||
if _OPTIONS["disable-base128"] then
|
||||
defines { "DISABLE_BASE128" }
|
||||
end
|
||||
|
@ -130,7 +130,7 @@ namespace Components
|
||||
|
||||
Node::Nodes.push_back(entry);
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Adding node %s...\n", address.GetCString());
|
||||
#endif
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace Components
|
||||
{
|
||||
if (node.state == Node::STATE_INVALID && (Game::Sys_Milliseconds() - node.lastHeard) > NODE_INVALID_DELETE)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Removing invalid node %s\n", node.address.GetCString());
|
||||
#endif
|
||||
}
|
||||
@ -231,14 +231,14 @@ namespace Components
|
||||
Proto::Node::Packet packet;
|
||||
packet.set_challenge(entry->challenge);
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Sending registration request to %s\n", entry->address.GetCString());
|
||||
#endif
|
||||
Network::SendCommand(entry->address, "nodeRegisterRequest", packet.SerializeAsString());
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Sending session request to %s\n", entry->address.GetCString());
|
||||
#endif
|
||||
Network::SendCommand(entry->address, "sessionRequest");
|
||||
@ -267,7 +267,7 @@ namespace Components
|
||||
node.lastHeard = Game::Sys_Milliseconds();
|
||||
node.lastTime = Game::Sys_Milliseconds();
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Node negotiation timed out. Invalidating %s\n", node.address.GetCString());
|
||||
#endif
|
||||
}
|
||||
@ -399,7 +399,7 @@ namespace Components
|
||||
if (!entry) return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Received registration request from %s\n", address.GetCString());
|
||||
#endif
|
||||
|
||||
@ -440,7 +440,7 @@ namespace Components
|
||||
Node::NodeEntry* entry = Node::FindNode(address);
|
||||
if (!entry || entry->state != Node::STATE_NEGOTIATING) return;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Received synchronization data for registration from %s!\n", address.GetCString());
|
||||
#endif
|
||||
|
||||
@ -467,7 +467,7 @@ namespace Components
|
||||
entry->state = Node::STATE_VALID;
|
||||
entry->registered = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Signature from %s for challenge '%s' is valid!\n", address.GetCString(), entry->challenge.data());
|
||||
Logger::Print("Node %s registered\n", address.GetCString());
|
||||
#endif
|
||||
@ -491,7 +491,7 @@ namespace Components
|
||||
Node::NodeEntry* entry = Node::FindNode(address);
|
||||
if (!entry || entry->state != Node::STATE_NEGOTIATING) return;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Received acknowledgment from %s\n", address.GetCString());
|
||||
#endif
|
||||
|
||||
@ -511,7 +511,7 @@ namespace Components
|
||||
entry->state = Node::STATE_VALID;
|
||||
entry->registered = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Signature from %s for challenge '%s' is valid!\n", address.GetCString(), entry->challenge.data());
|
||||
Logger::Print("Node %s registered\n", address.GetCString());
|
||||
#endif
|
||||
@ -554,7 +554,7 @@ namespace Components
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
// Unallowed connection
|
||||
Logger::Print("Node list requested by %s, but no valid session was present!\n", address.GetCString());
|
||||
#endif
|
||||
@ -584,13 +584,13 @@ namespace Components
|
||||
entry->registered = false;
|
||||
entry->state = Node::STATE_INVALID;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Node %s unregistered\n", address.GetCString());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Node %s tried to unregister using an invalid signature!\n", address.GetCString());
|
||||
#endif
|
||||
}
|
||||
@ -612,7 +612,7 @@ namespace Components
|
||||
Node::ClientSession* session = Node::FindSession(address);
|
||||
if (!session) return; // Registering template session failed, odd...
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Client %s is requesting a new session\n", address.GetCString());
|
||||
#endif
|
||||
|
||||
@ -634,7 +634,7 @@ namespace Components
|
||||
|
||||
if (session->challenge == data)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Session for %s validated.\n", address.GetCString());
|
||||
#endif
|
||||
session->valid = true;
|
||||
@ -643,7 +643,7 @@ namespace Components
|
||||
else
|
||||
{
|
||||
session->lastTime = -1;
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Challenge mismatch. Validating session for %s failed.\n", address.GetCString());
|
||||
#endif
|
||||
}
|
||||
@ -656,7 +656,7 @@ namespace Components
|
||||
Node::NodeEntry* entry = Node::FindNode(address);
|
||||
if (!entry) return;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Session initialization received from %s. Synchronizing...\n", address.GetCString());
|
||||
#endif
|
||||
|
||||
@ -673,7 +673,7 @@ namespace Components
|
||||
entry->registered = true;
|
||||
entry->lastTime = Game::Sys_Milliseconds();
|
||||
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Session acknowledged by %s, synchronizing node list...\n", address.GetCString());
|
||||
#endif
|
||||
Network::SendCommand(address, "nodeListRequest");
|
||||
@ -687,7 +687,7 @@ namespace Components
|
||||
|
||||
if (data.empty() || !list.ParseFromString(data))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Received invalid node list from %s!\n", address.GetCString());
|
||||
#endif
|
||||
return;
|
||||
@ -698,7 +698,7 @@ namespace Components
|
||||
{
|
||||
if (entry->registered)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if defined(DEBUG) && !defined(DISABLE_NODE_LOG)
|
||||
Logger::Print("Received valid node list with %i entries from %s\n", list.address_size(), address.GetCString());
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user