mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-11 17:37:53 +00:00
support of 'X' in RouterInfo
This commit is contained in:
parent
4d2f26b1cd
commit
a6785e9143
@ -205,7 +205,7 @@ namespace i2p
|
|||||||
|
|
||||||
void RouterContext::SetBandwidth (char L) {
|
void RouterContext::SetBandwidth (char L) {
|
||||||
uint16_t limit = 0;
|
uint16_t limit = 0;
|
||||||
enum { low, high, extra } type = high;
|
enum { low, high, extra, unlim } type = high;
|
||||||
/* detect parameters */
|
/* detect parameters */
|
||||||
switch (L)
|
switch (L)
|
||||||
{
|
{
|
||||||
@ -215,7 +215,7 @@ namespace i2p
|
|||||||
case i2p::data::CAPS_FLAG_HIGH_BANDWIDTH2 : limit = 128; type = high; break;
|
case i2p::data::CAPS_FLAG_HIGH_BANDWIDTH2 : limit = 128; type = high; break;
|
||||||
case i2p::data::CAPS_FLAG_HIGH_BANDWIDTH3 : limit = 256; type = high; break;
|
case i2p::data::CAPS_FLAG_HIGH_BANDWIDTH3 : limit = 256; type = high; break;
|
||||||
case i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH1 : limit = 2048; type = extra; break;
|
case i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH1 : limit = 2048; type = extra; break;
|
||||||
case i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH2 : limit = 9999; type = extra; break;
|
case i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH2 : limit = 9999; type = unlim; break;
|
||||||
default:
|
default:
|
||||||
limit = 48; type = low;
|
limit = 48; type = low;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,8 @@ namespace i2p
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case low : /* not set */; break;
|
case low : /* not set */; break;
|
||||||
case extra : caps |= i2p::data::RouterInfo::eExtraBandwidth; // no break here
|
case extra : caps |= i2p::data::RouterInfo::eExtraBandwidth; break; // 'P'
|
||||||
|
case unlim : caps |= i2p::data::RouterInfo::eExtraBandwidth; // no break here, extra + high means 'X'
|
||||||
case high : caps |= i2p::data::RouterInfo::eHighBandwidth; break;
|
case high : caps |= i2p::data::RouterInfo::eHighBandwidth; break;
|
||||||
}
|
}
|
||||||
m_RouterInfo.SetCaps (caps);
|
m_RouterInfo.SetCaps (caps);
|
||||||
|
@ -376,14 +376,21 @@ namespace data
|
|||||||
std::string caps;
|
std::string caps;
|
||||||
if (m_Caps & eFloodfill)
|
if (m_Caps & eFloodfill)
|
||||||
{
|
{
|
||||||
if (m_Caps & eExtraBandwidth) caps += CAPS_FLAG_EXTRA_BANDWIDTH1; // 'P'
|
if (m_Caps & eExtraBandwidth) caps += (m_Caps & eHighBandwidth) ?
|
||||||
|
CAPS_FLAG_EXTRA_BANDWIDTH2 : // 'X'
|
||||||
|
CAPS_FLAG_EXTRA_BANDWIDTH1; // 'P'
|
||||||
caps += CAPS_FLAG_HIGH_BANDWIDTH3; // 'O'
|
caps += CAPS_FLAG_HIGH_BANDWIDTH3; // 'O'
|
||||||
caps += CAPS_FLAG_FLOODFILL; // floodfill
|
caps += CAPS_FLAG_FLOODFILL; // floodfill
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Caps & eExtraBandwidth) caps += CAPS_FLAG_EXTRA_BANDWIDTH1; // 'P'
|
if (m_Caps & eExtraBandwidth)
|
||||||
caps += (m_Caps & eHighBandwidth) ? CAPS_FLAG_HIGH_BANDWIDTH3 /* 'O' */: CAPS_FLAG_LOW_BANDWIDTH2 /* 'L' */; // bandwidth
|
{
|
||||||
|
caps += (m_Caps & eHighBandwidth) ? CAPS_FLAG_EXTRA_BANDWIDTH2 /* 'X' */ : CAPS_FLAG_EXTRA_BANDWIDTH1; /*'P' */
|
||||||
|
caps += CAPS_FLAG_HIGH_BANDWIDTH3; // 'O'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
caps += (m_Caps & eHighBandwidth) ? CAPS_FLAG_HIGH_BANDWIDTH3 /* 'O' */: CAPS_FLAG_LOW_BANDWIDTH2 /* 'L' */; // bandwidth
|
||||||
}
|
}
|
||||||
if (m_Caps & eHidden) caps += CAPS_FLAG_HIDDEN; // hidden
|
if (m_Caps & eHidden) caps += CAPS_FLAG_HIDDEN; // hidden
|
||||||
if (m_Caps & eReachable) caps += CAPS_FLAG_REACHABLE; // reachable
|
if (m_Caps & eReachable) caps += CAPS_FLAG_REACHABLE; // reachable
|
||||||
|
Loading…
Reference in New Issue
Block a user