handle session with STYLE=DATAGRAM2 and STYLE=DATAGRAM3
Some checks failed
Build containers / Building container for linux/386 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / trixie (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled

This commit is contained in:
orignal 2025-07-23 12:54:46 -04:00
parent 6b9278fdd3
commit d5769080c8
2 changed files with 27 additions and 7 deletions

View file

@ -353,8 +353,27 @@ namespace client
}
SAMSessionType type = eSAMSessionTypeUnknown;
i2p::datagram::DatagramVersion datagramVersion = i2p::datagram::eDatagramV1;
if (style == SAM_VALUE_STREAM) type = eSAMSessionTypeStream;
else if (style == SAM_VALUE_DATAGRAM) type = eSAMSessionTypeDatagram;
#if __cplusplus >= 202002L // C++20
else if (style.starts_with (SAM_VALUE_DATAGRAM))
#else
else if (style.substr (0, SAM_VALUE_DATAGRAM.size ()) == SAM_VALUE_DATAGRAM)
#endif
{
// DATAGRAM, DATAGRAM1, DATAGRAM2, DATAGRAM3
type = eSAMSessionTypeDatagram;
if (style.size () > SAM_VALUE_DATAGRAM.size ())
{
switch (style[SAM_VALUE_DATAGRAM.size ()])
{
case '1': datagramVersion = i2p::datagram::eDatagramV1; break;
case '2': datagramVersion = i2p::datagram::eDatagramV2; break;
case '3': datagramVersion = i2p::datagram::eDatagramV3; break;
default: type = eSAMSessionTypeUnknown;
}
}
}
else if (style == SAM_VALUE_RAW) type = eSAMSessionTypeRaw;
else if (style == SAM_VALUE_MASTER) type = eSAMSessionTypeMaster;
if (type == eSAMSessionTypeUnknown)
@ -416,7 +435,7 @@ namespace client
if (type == eSAMSessionTypeDatagram || type == eSAMSessionTypeRaw)
{
session->UDPEndpoint = forward;
auto dest = session->GetLocalDestination ()->CreateDatagramDestination ();
auto dest = session->GetLocalDestination ()->CreateDatagramDestination (false, datagramVersion);
uint16_t port = 0;
if (forward)
{