Browse Source

reduced memory footprint

pull/766/head
orignal 8 years ago
parent
commit
57310fdbd6
  1. 7
      NTCPSession.cpp
  2. 3
      NTCPSession.h

7
NTCPSession.cpp

@ -525,7 +525,7 @@ namespace transport @@ -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 @@ -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);

3
NTCPSession.h

@ -35,12 +35,11 @@ namespace transport @@ -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

Loading…
Cancel
Save