mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-26 04:31:55 +00:00
decline master session if SAM version is less than 3.3
This commit is contained in:
parent
7dd174d32c
commit
83f9e1098d
@ -373,7 +373,15 @@ namespace client
|
||||
}
|
||||
}
|
||||
else if (style == SAM_VALUE_RAW) type = SAMSessionType::eSAMSessionTypeRaw;
|
||||
else if (style == SAM_VALUE_MASTER) type = SAMSessionType::eSAMSessionTypeMaster;
|
||||
else if (style == SAM_VALUE_MASTER)
|
||||
{
|
||||
if (m_Version < SAM_VERSION_33) // < SAM 3.3
|
||||
{
|
||||
SendSessionI2PError("MASTER session is not supported");
|
||||
return;
|
||||
}
|
||||
type = SAMSessionType::eSAMSessionTypeMaster;
|
||||
}
|
||||
if (type == SAMSessionType::eSAMSessionTypeUnknown)
|
||||
{
|
||||
// unknown style
|
||||
@ -868,6 +876,11 @@ namespace client
|
||||
|
||||
void SAMSocket::ProcessSessionAdd (std::string_view buf)
|
||||
{
|
||||
if (m_Version < SAM_VERSION_33) // < SAM 3.3
|
||||
{
|
||||
SendSessionI2PError("SESSION ADD is not supported");
|
||||
return;
|
||||
}
|
||||
auto session = m_Owner.FindSession(m_ID);
|
||||
if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster)
|
||||
{
|
||||
@ -918,6 +931,11 @@ namespace client
|
||||
|
||||
void SAMSocket::ProcessSessionRemove (std::string_view buf)
|
||||
{
|
||||
if (m_Version < SAM_VERSION_33) // < SAM 3.3
|
||||
{
|
||||
SendSessionI2PError("SESSION REMOVE is not supported");
|
||||
return;
|
||||
}
|
||||
auto session = m_Owner.FindSession(m_ID);
|
||||
if (session && session->Type == SAMSessionType::eSAMSessionTypeMaster)
|
||||
{
|
||||
|
@ -94,6 +94,7 @@ namespace client
|
||||
constexpr int MAKE_SAM_VERSION_NUMBER (int major, int minor) { return major*10 + minor; }
|
||||
constexpr int MIN_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 0);
|
||||
constexpr int MAX_SAM_VERSION = MAKE_SAM_VERSION_NUMBER (3, 3);
|
||||
constexpr int SAM_VERSION_33 = MAKE_SAM_VERSION_NUMBER (3, 3); // SAM 3.3
|
||||
|
||||
enum class SAMSocketType
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user