mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-19 13:36:03 -04:00
Set a RateCap that is 75% of absolute bandwidth limit. This reduced rate is required because
of the overhead associated with TCP and Relay connections: * The Internal rate is calculated based on transmitted data (a reliable stream). * The Relay rate is calculated at UDP packet level and is x1.1 - x1.2 higher than internal rate. The Relay will drop the connection if peers exceed specified level - so best to leave some head room. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4773 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8267739b02
commit
3d4feaaaf7
@ -251,7 +251,18 @@ int pqissludp::Initiate_Connection()
|
||||
std::cerr << remote_addr << ")" << std::endl;
|
||||
|
||||
tou_connect_via_relay(sockfd, &(mConnectSrcAddr), &(mConnectProxyAddr), &(remote_addr));
|
||||
parent()->setRateCap( mConnectBandwidth / 1000.0, mConnectBandwidth / 1000.0); // Set RateCap.
|
||||
|
||||
/*** It seems that the UDP Layer sees x 1.2 the traffic of the SSL layer.
|
||||
* We need to compensate somewhere... we drop the maximum traffic to 75% of limit
|
||||
* to allow for extra lost packets etc.
|
||||
* NB: If we have a lossy UDP transmission - re-transmission could cause excessive data to
|
||||
* exceed the limit... This is difficult to account for without hacking the TcpOnUdp layer.
|
||||
* If it is noticed as a problem - we'll deal with it then
|
||||
*/
|
||||
#define UDP_RELAY_TRANSPORT_OVERHEAD_FACTOR (0.7)
|
||||
|
||||
parent()->setRateCap( UDP_RELAY_TRANSPORT_OVERHEAD_FACTOR * mConnectBandwidth / 1000.0,
|
||||
UDP_RELAY_TRANSPORT_OVERHEAD_FACTOR * mConnectBandwidth / 1000.0); // Set RateCap.
|
||||
}
|
||||
|
||||
if (0 != err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user