| 2642 | } |
| 2643 | |
| 2644 | bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) |
| 2645 | { |
| 2646 | LOCK(cs_totalBytesSent); |
| 2647 | if (nMaxOutboundLimit == 0) |
| 2648 | return false; |
| 2649 | |
| 2650 | if (historicalBlockServingLimit) |
| 2651 | { |
| 2652 | // keep a large enough buffer to at least relay each block once |
| 2653 | uint64_t timeLeftInCycle = GetMaxOutboundTimeLeftInCycle(); |
| 2654 | uint64_t buffer = timeLeftInCycle / 600 * MAX_BLOCK_SERIALIZED_SIZE; |
| 2655 | if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer) |
| 2656 | return true; |
| 2657 | } |
| 2658 | else if (nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit) |
| 2659 | return true; |
| 2660 | |
| 2661 | return false; |
| 2662 | } |
| 2663 | |
| 2664 | uint64_t CConnman::GetOutboundTargetBytesLeft() |
| 2665 | { |
no outgoing calls
no test coverage detected