mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
Add better handling of RTT for STREAM_P2P
This commit is contained in:
parent
bbda618beb
commit
2babe4c236
1 changed files with 14 additions and 1 deletions
|
@ -282,12 +282,25 @@ public:
|
|||
{
|
||||
std::lock_guard lock(data_mutex);
|
||||
rtts[sock_id].num_retries = 0;
|
||||
// TODO: reduce RTT?
|
||||
|
||||
const auto now = std::chrono::system_clock::now();
|
||||
|
||||
for (auto it = msgs.begin(); it != msgs.end();)
|
||||
{
|
||||
auto& msg = it->second;
|
||||
if (msg.sock_id == sock_id && msg.seq < ack)
|
||||
{
|
||||
// Decreases RTT if msg is early
|
||||
if (now < it->first)
|
||||
{
|
||||
const auto actual_rtt = std::chrono::duration_cast<std::chrono::milliseconds>(now - it->second.initial_sendtime);
|
||||
const auto cur_rtt = rtts[sock_id].rtt_time;
|
||||
if (cur_rtt > actual_rtt)
|
||||
{
|
||||
rtts[sock_id].rtt_time = (actual_rtt + cur_rtt) / 2;
|
||||
}
|
||||
|
||||
}
|
||||
it = msgs.erase(it);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue