From b199d74088cf08af3e2ac8ecd45dd7ea326e51c5 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 26 Mar 2026 11:54:23 +0000 Subject: [PATCH] Fix the message counts in RPL_STATSLINKINFO. --- include/uplink.h | 4 +++- src/messages.cpp | 3 ++- src/process.cpp | 2 ++ src/uplink.cpp | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/uplink.h b/include/uplink.h index 1b104f6ed..e72e85afd 100644 --- a/include/uplink.h +++ b/include/uplink.h @@ -54,7 +54,9 @@ class UplinkSocket final , public BufferedSocket { public: - bool error; + bool error = false; + size_t recv_msgs = 0; + size_t sent_msgs = 0; UplinkSocket(); ~UplinkSocket(); bool ProcessRead() override; diff --git a/src/messages.cpp b/src/messages.cpp index 17c3daa32..afc005b11 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -402,7 +402,8 @@ void Stats::Run(MessageSource &source, const std::vector ¶ms, if (u->HasMode("OPER")) { IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), "Server SendBuf SentBytes SentMsgs RecvBuf RecvBytes RecvMsgs ConnTime"); - IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), Config->Uplinks[Anope::CurrentUplink].host, UplinkSock->WriteBufferLen(), TotalWritten, -1, UplinkSock->ReadBufferLen(), TotalRead, -1, Anope::CurTime - Anope::StartTime); + IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), Config->Uplinks[Anope::CurrentUplink].host, UplinkSock->WriteBufferLen(), + TotalWritten, UplinkSock->sent_msgs, UplinkSock->ReadBufferLen(), TotalRead, UplinkSock->recv_msgs, Anope::CurTime - Anope::StartTime); } IRCD->SendNumeric(RPL_STATSLINKINFO, source.GetSource(), params[0][0], "End of /STATS report."); diff --git a/src/process.cpp b/src/process.cpp index 95f36359e..5dce80fce 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -18,6 +18,7 @@ #include "servers.h" #include "users.h" #include "regchannel.h" +#include "uplink.h" void Anope::Process(const Anope::string &buffer) { @@ -86,6 +87,7 @@ void Anope::ProcessInternal(MessageSource &src, const Anope::string &command, co { try { + UplinkSock->recv_msgs++; m->Run(src, params, tags); } catch (const ProtocolException &err) diff --git a/src/uplink.cpp b/src/uplink.cpp index 4b8fa4f92..d6281924a 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -76,6 +76,7 @@ void Uplink::SendInternal(const Anope::map &tags, const MessageSo if (!IRCD->Format(message, tags, source, command, params)) return; + UplinkSock->sent_msgs++; UplinkSock->Write(message); Log(LOG_RAWIO) << "Sent " << message; @@ -108,7 +109,6 @@ void Uplink::SendInternal(const Anope::map &tags, const MessageSo UplinkSocket::UplinkSocket() : Socket(-1, Config->Uplinks[Anope::CurrentUplink].protocol), ConnectionSocket(), BufferedSocket() { - error = false; UplinkSock = this; }