implement PING command
Some checks failed
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 / Building container for linux/386 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled

This commit is contained in:
orignal 2025-08-31 17:50:02 -04:00
parent 1d7c7ac148
commit 3522a3180b
2 changed files with 19 additions and 1 deletions

View file

@ -248,6 +248,14 @@ namespace client
char * separator = strchr (m_Buffer, ' ');
if (separator)
{
// one word command
if (std::string_view (m_Buffer, separator - m_Buffer) == SAM_PING)
{
ProcessPing ({ separator + 1, (size_t)(eol - separator - 1) });
return;
}
// two words command
size_t l = 0;
separator = strchr (separator + 1, ' ');
if (separator)
@ -955,6 +963,12 @@ namespace client
SendSessionI2PError ("Wrong session type");
}
void SAMSocket::ProcessPing (std::string_view text)
{
LogPrint (eLogDebug, "SAM: Ping ", text);
SendReplyWithMessage (SAM_PONG, std::string (text));
}
void SAMSocket::SendReplyWithMessage (const char * reply, const std::string & msg)
{
#ifdef _MSC_VER