diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/actors/interconnect/ut/lib/interrupter.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/actors/interconnect/ut/lib/interrupter.h')
-rw-r--r-- | library/cpp/actors/interconnect/ut/lib/interrupter.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/library/cpp/actors/interconnect/ut/lib/interrupter.h b/library/cpp/actors/interconnect/ut/lib/interrupter.h index a4a4373f3e..48851de2c5 100644 --- a/library/cpp/actors/interconnect/ut/lib/interrupter.h +++ b/library/cpp/actors/interconnect/ut/lib/interrupter.h @@ -26,7 +26,7 @@ class TTrafficInterrupter TVector<char> Data; }; struct TCompare { - bool operator()(const std::pair<TInstant, TDelayedPacket>& x, const std::pair<TInstant, TDelayedPacket>& y) const { + bool operator()(const std::pair<TInstant, TDelayedPacket>& x, const std::pair<TInstant, TDelayedPacket>& y) const { return x.first > y.first; }; }; @@ -160,7 +160,7 @@ private: timeout = Min(timeout, conn.DelayedQueue.top().first - TInstant::Now()); } }; - for (auto& it : Connections) { + for (auto& it : Connections) { updateTimout(it.ForwardConnection); updateTimout(it.BackwardConnection); } @@ -177,20 +177,20 @@ private: } if (DelayTraffic) { // process packets from DelayQueues auto processDelayedPackages = [](TDirectedConnection& conn) { - while (!conn.DelayedQueue.empty()) { - auto& frontPackage = conn.DelayedQueue.top(); - if (TInstant::Now() >= frontPackage.first) { - TInet6StreamSocket* sock = frontPackage.second.ForwardSocket; - if (sock) { + while (!conn.DelayedQueue.empty()) { + auto& frontPackage = conn.DelayedQueue.top(); + if (TInstant::Now() >= frontPackage.first) { + TInet6StreamSocket* sock = frontPackage.second.ForwardSocket; + if (sock) { sock->Send(frontPackage.second.Data.data(), frontPackage.second.Data.size()); } - conn.DelayedQueue.pop(); - } else { - break; + conn.DelayedQueue.pop(); + } else { + break; } - } - }; - for (auto& it : Connections) { + } + }; + for (auto& it : Connections) { processDelayedPackages(it.ForwardConnection); processDelayedPackages(it.BackwardConnection); } @@ -228,7 +228,7 @@ private: if (recvSize > 0) { if (DelayTraffic) { // put packet into DelayQueue - const TDuration baseDelay = TDuration::MicroSeconds(recvSize * 1e6 / Bandwidth); + const TDuration baseDelay = TDuration::MicroSeconds(recvSize * 1e6 / Bandwidth); const TInstant now = TInstant::Now(); directedConnection->Timestamp = Max(now, directedConnection->Timestamp) + baseDelay; TDelayedPacket pkt; |