| 1663 | } |
| 1664 | |
| 1665 | void TUdpHost::OneStep() { |
| 1666 | if (IB.Get()) { |
| 1667 | NHPTimer::STime tChk = CurrentT; |
| 1668 | float chkDeltaT = (float)NHPTimer::GetTimePassed(&tChk); |
| 1669 | if (IB->Step(tChk)) { |
| 1670 | IBIdleTime = -chkDeltaT; |
| 1671 | } |
| 1672 | if (chkDeltaT < 0.0005) { |
| 1673 | return; |
| 1674 | } |
| 1675 | } |
| 1676 | |
| 1677 | if (UseTOSforAcks) { |
| 1678 | DefaultTos.SetDataTos(0x60); |
| 1679 | DefaultTos.SetAckTos(0x20); |
| 1680 | } else { |
| 1681 | DefaultTos.SetDataTos(0); |
| 1682 | DefaultTos.SetAckTos(0); |
| 1683 | } |
| 1684 | |
| 1685 | RecvCycle(); |
| 1686 | while (ProcessIBRequest()) |
| 1687 | ; //TODO implement some limitations |
| 1688 | |
| 1689 | float deltaT = (float)NHPTimer::GetTimePassed(&CurrentT); |
| 1690 | TimeSinceSocketStatsUpdate += deltaT; |
| 1691 | deltaT = ClampVal(deltaT, 0.0f, UdpTransferTimeout / 3); |
| 1692 | |
| 1693 | MaxWaitTime = DEFAULT_MAX_WAIT_TIME; |
| 1694 | IBIdleTime += deltaT; |
| 1695 | |
| 1696 | CheckConnectionsAndSendAcks(); |
| 1697 | |
| 1698 | // send data for outbound connections |
| 1699 | InjectTransfers(&SendOrderSystem, 0); |
| 1700 | InjectTransfers(&SendOrderHigh, 1); |
| 1701 | InjectTransfers(&SendOrder, 2); |
| 1702 | InjectTransfers(&SendOrderLow, 3); |
| 1703 | |
| 1704 | ui8 prio = 0; |
| 1705 | while (SendCycle(prio++)) { |
| 1706 | if (prio > PP_SYSTEM) { |
| 1707 | break; |
| 1708 | } |
| 1709 | } |
| 1710 | |
| 1711 | // roll send order to avoid exotic problems with lots of peers and high traffic |
| 1712 | //SendOrderSystem.splice(SendOrderSystem.end(), SendOrderSystem, SendOrderSystem.begin()); |
| 1713 | //SendOrder.splice(SendOrder.end(), SendOrder, SendOrder.begin()); // sending data in order has lower delay and shorter queue |
| 1714 | if (TimeSinceSocketStatsUpdate > STAT_UPDATE_TIME) { |
| 1715 | S.UpdateStats(); |
| 1716 | FailureStats.Update(); |
| 1717 | TimeSinceSocketStatsUpdate = 0; |
| 1718 | } |
| 1719 | } |
| 1720 | |
| 1721 | //do nothing, keep it for compatibility |
| 1722 | void TUdpHost::Step() { |
nothing calls this directly
no test coverage detected