| 93 | |
| 94 | if (n > 0) |
| 95 | { |
| 96 | total += n; |
| 97 | |
| 98 | address += n; |
| 99 | buffer = static_cast<char *>(buffer) + n; |
| 100 | len -= n; |
| 101 | |
| 102 | if (state == KTTransferState::Page) |
| 103 | { |
| 104 | contiguousSuccess += n; |
| 105 | |
| 106 | if (contiguousSuccess >= KT_RETRY_NORMAL_AFTER) |
| 107 | { |
| 108 | state = KTTransferState::Normal; |
| 109 | contiguousSuccess = 0; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | // partial success means remaining bytes are still pending |
| 114 | if (n != requestSize && mode == MemMode::Normal) |
| 115 | { |
| 116 | break; |
| 117 | } |
| 118 | |
| 119 | continue; |
| 120 | } |
| 121 | |
| 122 | /* |
| 123 | * No bytes transferred. |
| 124 | */ |
| 125 | |
| 126 | if (mode == MemMode::Normal) |
| 127 | break; |
| 128 | |
| 129 | if (state == KTTransferState::Normal) |
| 130 | { |
| 131 | /* |
| 132 | * Large request failed. |
| 133 | * Switch to page scanning. |
| 134 | */ |
| 135 | state = KTTransferState::Page; |
| 136 | contiguousSuccess = 0; |
| 137 | continue; |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | * Page failed. |
| 142 | * Skip it. |
| 143 | */ |
| 144 | size_t skip = std::min(KT_PAGE_REMAIN(address), len); |
| 145 |
no test coverage detected