| 2978 | } |
| 2979 | |
| 2980 | bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) const |
| 2981 | { |
| 2982 | LOCK(cs_totalBytesSent); |
| 2983 | if (nMaxOutboundLimit == 0) |
| 2984 | return false; |
| 2985 | |
| 2986 | if (historicalBlockServingLimit) |
| 2987 | { |
| 2988 | // keep a large enough buffer to at least relay each block once |
| 2989 | const std::chrono::seconds timeLeftInCycle = GetMaxOutboundTimeLeftInCycle(); |
| 2990 | const uint64_t buffer = timeLeftInCycle / std::chrono::minutes{10} * MAX_BLOCK_SERIALIZED_SIZE; |
| 2991 | if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer) |
| 2992 | return true; |
| 2993 | } |
| 2994 | else if (nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit) |
| 2995 | return true; |
| 2996 | |
| 2997 | return false; |
| 2998 | } |
| 2999 | |
| 3000 | uint64_t CConnman::GetOutboundTargetBytesLeft() const |
| 3001 | { |
no outgoing calls