| 2964 | } |
| 2965 | |
| 2966 | std::chrono::seconds CConnman::GetMaxOutboundTimeLeftInCycle() const |
| 2967 | { |
| 2968 | LOCK(cs_totalBytesSent); |
| 2969 | if (nMaxOutboundLimit == 0) |
| 2970 | return 0s; |
| 2971 | |
| 2972 | if (nMaxOutboundCycleStartTime.count() == 0) |
| 2973 | return MAX_UPLOAD_TIMEFRAME; |
| 2974 | |
| 2975 | const std::chrono::seconds cycleEndTime = nMaxOutboundCycleStartTime + MAX_UPLOAD_TIMEFRAME; |
| 2976 | const auto now = GetTime<std::chrono::seconds>(); |
| 2977 | return (cycleEndTime < now) ? 0s : cycleEndTime - now; |
| 2978 | } |
| 2979 | |
| 2980 | bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) const |
| 2981 | { |