From fcb3090055429a108b9837dbd4ba505d9c291129 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 11 Mar 2026 21:54:40 +0000 Subject: Rework sending server protocol messages. - Replace CmdBuilder with MessageBuilder. This has a less footgun API. All message building has to go through this now so we can implement other message formats in the future. - Replace the message parsing in WriteLine with an analogue to PreProcessOldProtocolMessage. This should be much faster. - Move parameter translation from the core to spanningtree. - Change EncodeParameter to return the value instead of updating in place. - Replace the OnBuild*Message events with one OnServerMessage that can now access all parts of the message and change them. --- modules/spanningtree/pingtimer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/spanningtree/pingtimer.cpp') diff --git a/modules/spanningtree/pingtimer.cpp b/modules/spanningtree/pingtimer.cpp index cc6adb5d4..444abcfaa 100644 --- a/modules/spanningtree/pingtimer.cpp +++ b/modules/spanningtree/pingtimer.cpp @@ -23,7 +23,7 @@ #include "pingtimer.h" #include "treeserver.h" -#include "commandbuilder.h" +#include "msgbuilder.h" PingTimer::PingTimer(TreeServer* ts) : Timer(Utils->PingFreq, false) @@ -38,7 +38,9 @@ PingTimer::State PingTimer::TickInternal() if (state == PS_SENDPING) { // Last ping was answered, send next ping - server->GetSocket()->WriteLine(CmdBuilder("PING").push(server->GetId())); + MessageBuilder("PING") + .Push(server->GetId()) + .Unicast(server); LastPingMsec = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); // Warn next unless warnings are disabled. If they are, jump straight to timeout. if (Utils->PingWarnTime) -- cgit v1.3.1-10-gc9f91