Merge pull request #2468 from parsebulb/ping-no-close

Don't close connection after PONG
This commit is contained in:
orignal
2026-08-11 06:33:04 -04:00
committed by GitHub
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -939,34 +939,34 @@ namespace client
void SAMSocket::ProcessPing (std::string_view text)
{
LogPrint (eLogDebug, "SAM: Ping ", text);
SendReplyWithMessage (SAM_PONG, std::string (text));
SendReplyWithMessage (SAM_PONG, std::string (text), false);
}
void SAMSocket::SendReplyWithMessage (const char * reply, const std::string & msg)
void SAMSocket::SendReplyWithMessage (const char * reply, const std::string & msg, bool close)
{
#ifdef _MSC_VER
size_t len = sprintf_s (m_Buffer, SAM_SOCKET_BUFFER_SIZE, reply, msg.c_str());
#else
size_t len = snprintf (m_Buffer, SAM_SOCKET_BUFFER_SIZE, reply, msg.c_str());
#endif
SendMessageReply ({m_Buffer, len}, true);
SendMessageReply ({m_Buffer, len}, close);
}
void SAMSocket::SendSessionI2PError(const std::string & msg)
{
LogPrint (eLogError, "SAM: Session I2P error: ", msg);
SendReplyWithMessage (SAM_SESSION_STATUS_I2P_ERROR, msg);
SendReplyWithMessage (SAM_SESSION_STATUS_I2P_ERROR, msg, true);
}
void SAMSocket::SendStreamI2PError(const std::string & msg)
{
LogPrint (eLogError, "SAM: Stream I2P error: ", msg);
SendReplyWithMessage (SAM_STREAM_STATUS_I2P_ERROR, msg);
SendReplyWithMessage (SAM_STREAM_STATUS_I2P_ERROR, msg, true);
}
void SAMSocket::SendStreamCantReachPeer(const std::string & msg)
{
SendReplyWithMessage (SAM_STREAM_STATUS_CANT_REACH_PEER, msg);
SendReplyWithMessage (SAM_STREAM_STATUS_CANT_REACH_PEER, msg, true);
}
void SAMSocket::HandleNamingLookupLeaseSetRequestComplete (std::shared_ptr<i2p::data::LeaseSet> leaseSet, std::string name)
+1 -1
View File
@@ -162,7 +162,7 @@ namespace client
void ProcessSessionAdd (std::string_view buf);
void ProcessSessionRemove (std::string_view buf);
void ProcessPing (std::string_view text);
void SendReplyWithMessage (const char * reply, const std::string & msg);
void SendReplyWithMessage (const char * reply, const std::string & msg, bool close);
void SendSessionI2PError(const std::string & msg);
void SendStreamI2PError(const std::string & msg);
void SendStreamCantReachPeer(const std::string & msg);