diff options
| author | Stefan Boberg <[email protected]> | 2021-09-16 13:14:02 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-16 13:14:02 +0200 |
| commit | 99c560212f0752b20a07fe6e968e93b9a70e7d4e (patch) | |
| tree | 96c2df68df0e5d25c89517f1013306a7dc4deaf9 | |
| parent | Fixed some unreferenced variable warnings (why don't we get these in sln buil... (diff) | |
| download | zen-99c560212f0752b20a07fe6e968e93b9a70e7d4e.tar.xz zen-99c560212f0752b20a07fe6e968e93b9a70e7d4e.zip | |
Fixed up mesh logging
| -rw-r--r-- | zenserver/upstream/zen.cpp | 11 | ||||
| -rw-r--r-- | zenserver/upstream/zen.h | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/zenserver/upstream/zen.cpp b/zenserver/upstream/zen.cpp index eef92bab4..b553558e7 100644 --- a/zenserver/upstream/zen.cpp +++ b/zenserver/upstream/zen.cpp @@ -5,6 +5,7 @@ #include <zencore/compactbinarybuilder.h> #include <zencore/compactbinaryvalidation.h> #include <zencore/fmtutils.h> +#include <zencore/session.h> #include <zencore/stream.h> #include "cache/structuredcachestore.h" @@ -72,7 +73,7 @@ namespace detail { // Note that currently this just implements an UDP echo service for testing purposes -Mesh::Mesh(asio::io_context& IoContext) : m_IoContext(IoContext) +Mesh::Mesh(asio::io_context& IoContext) : m_Log(logging::Get("mesh")), m_IoContext(IoContext), m_SessionId(zen::GetSessionId()) { } @@ -257,10 +258,10 @@ Mesh::IssueReceive() if (SessionId != Oid::Zero && SessionId != m_SessionId) { - const uint16_t Port = (++It)->AsUInt16(m_SenderEndpoint.port()); - const uint32_t Lsn = (++It)->AsUInt32(); + // const uint16_t Port = (++It)->AsUInt16(m_SenderEndpoint.port()); + // const uint32_t Lsn = (++It)->AsUInt32(); - ZEN_INFO("received hey from {} ({})", SenderIp, SessionId); + ZEN_TRACE("received hey from {} ({})", SenderIp, SessionId); RwLock::ExclusiveLockScope _(m_SessionsLock); @@ -279,7 +280,7 @@ Mesh::IssueReceive() { Oid SessionId = Field.AsObjectId(); - ZEN_INFO("received bye from {} ({})", SenderIp, SessionId); + ZEN_DEBUG("received bye from {} ({})", SenderIp, SessionId); // We could verify that it's sent from a known IP before erasing the // session, if we want to be paranoid diff --git a/zenserver/upstream/zen.h b/zenserver/upstream/zen.h index 541495818..ff4a551bf 100644 --- a/zenserver/upstream/zen.h +++ b/zenserver/upstream/zen.h @@ -4,6 +4,7 @@ #include <zencore/iobuffer.h> #include <zencore/iohash.h> +#include <zencore/logging.h> #include <zencore/memory.h> #include <zencore/thread.h> #include <zencore/uid.h> @@ -59,6 +60,9 @@ private: static const int kMaxMessageSize = 2048; static const int kMaxUpdateSize = 1400; // We'll try not to send messages larger than this + spdlog::logger& Log() { return m_Log; } + + spdlog::logger& m_Log; std::atomic<State> m_State = kInitializing; asio::io_context& m_IoContext; std::unique_ptr<asio::ip::udp::socket> m_UdpSocket; @@ -68,7 +72,7 @@ private: uint16_t m_Port = 0; uint8_t m_MessageBuffer[kMaxMessageSize]; asio::high_resolution_timer m_Timer{m_IoContext}; - Oid m_SessionId{Oid::NewOid()}; + Oid m_SessionId; struct PeerInfo { |