| 3990 | } |
| 3991 | |
| 3992 | bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) const |
| 3993 | { |
| 3994 | AssertLockNotHeld(m_total_bytes_sent_mutex); |
| 3995 | LOCK(m_total_bytes_sent_mutex); |
| 3996 | if (nMaxOutboundLimit == 0) |
| 3997 | return false; |
| 3998 | |
| 3999 | if (historicalBlockServingLimit) |
| 4000 | { |
| 4001 | // keep a large enough buffer to at least relay each block once |
| 4002 | const std::chrono::seconds timeLeftInCycle = GetMaxOutboundTimeLeftInCycle_(); |
| 4003 | const uint64_t buffer = timeLeftInCycle / std::chrono::minutes{10} * MAX_BLOCK_SERIALIZED_SIZE; |
| 4004 | if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer) |
| 4005 | return true; |
| 4006 | } |
| 4007 | else if (nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit) |
| 4008 | return true; |
| 4009 | |
| 4010 | return false; |
| 4011 | } |
| 4012 | |
| 4013 | uint64_t CConnman::GetOutboundTargetBytesLeft() const |
| 4014 | { |
no outgoing calls
no test coverage detected