From 9fbc41c9bbbbbd6b5219f5ad505d8a088e1bf7c6 Mon Sep 17 00:00:00 2001 From: PobreGato <315121269+pobregat0@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:42:53 -0500 Subject: [PATCH] SAM: send each datagram subsession with its own version --- libi2pd_client/SAM.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp index 6f54a03a..2d0e793e 100644 --- a/libi2pd_client/SAM.cpp +++ b/libi2pd_client/SAM.cpp @@ -1502,11 +1502,20 @@ namespace client LogPrint (eLogError, "SAM: Datagram invalid destination ", destination); return; } - auto sendTo = [datagramDest, type = Type, fromPort, toPort] + auto sendTo = [datagramDest, type = Type, version = DatagramVersion, fromPort, toPort] (const uint8_t * p, size_t l, const i2p::data::IdentHash& ident) { if (type == SAMSessionType::eSAMSessionTypeDatagram) - datagramDest->SendDatagramTo (p, l, ident, fromPort, toPort); + { + // use this subsession's datagram version, not the destination default fixed by the first subsession + auto session = datagramDest->GetSession (ident); + if (session) + { + session->SetVersion (version); + datagramDest->SendDatagram (session, p, l, fromPort, toPort); + datagramDest->FlushSendQueue (session); + } + } else if (type == SAMSessionType::eSAMSessionTypeRaw) datagramDest->SendRawDatagramTo (p, l, ident, fromPort, toPort); else