reduced memory footprint

This commit is contained in:
orignal 2017-01-03 11:52:28 -05:00
parent 62ca6212ce
commit 57310fdbd6
2 changed files with 6 additions and 4 deletions

View File

@ -525,7 +525,7 @@ namespace transport
memcpy (m_ReceiveBuffer, nextBlock, m_ReceiveBufferOffset);
// try to read more
if (numReloads < 5)
if (numReloads < 16) // ~16K
{
boost::system::error_code ec;
size_t moreBytes = m_Socket.available(ec);
@ -541,9 +541,12 @@ namespace transport
return;
}
m_NumReceivedBytes += moreBytes;
i2p::transport::transports.UpdateReceivedBytes (bytes_transferred);
m_ReceiveBufferOffset += moreBytes;
numReloads++;
}
else
break; // no more data
}
}
while (m_ReceiveBufferOffset >= 16);

View File

@ -35,12 +35,11 @@ namespace transport
};
const size_t NTCP_MAX_MESSAGE_SIZE = 16384;
const size_t NTCP_BUFFER_SIZE = 4160; // fits 4 tunnel messages (4*1028)
const size_t NTCP_BUFFER_SIZE = 1028; // fits 1 tunnel data message
const int NTCP_CONNECT_TIMEOUT = 5; // 5 seconds
const int NTCP_TERMINATION_TIMEOUT = 120; // 2 minutes
const int NTCP_TERMINATION_CHECK_TIMEOUT = 30; // 30 seconds
const size_t NTCP_DEFAULT_PHASE3_SIZE = 2/*size*/ + i2p::data::DEFAULT_IDENTITY_SIZE/*387*/ + 4/*ts*/ + 15/*padding*/ + 40/*signature*/; // 448
const int NTCP_BAN_EXPIRATION_TIMEOUT = 70; // in second
const int NTCP_CLOCK_SKEW = 60; // in seconds
const int NTCP_MAX_OUTGOING_QUEUE_SIZE = 200; // how many messages we can queue up