| 8 | } // namespace |
| 9 | |
| 10 | SC::Result SC::HttpClientOperationScheduler::init(const HttpClientOperationSchedulerMemory& memory) |
| 11 | { |
| 12 | if (initialized) |
| 13 | return Result::Error(HttpClientResultCategory, HttpClientError::SchedulerAlreadyInitialized); |
| 14 | if (memory.operations.empty()) |
| 15 | return Result::Error(HttpClientResultCategory, HttpClientError::SchedulerOperationsMissing); |
| 16 | if (memory.readyOperations.sizeInElements() < memory.operations.sizeInElements()) |
| 17 | return Result::Error(HttpClientResultCategory, HttpClientError::SchedulerReadyStorageTooSmall); |
| 18 | |
| 19 | // Validate every entry before installing any notifier or changing caller-owned ready state. |
| 20 | for (size_t idx = 0; idx < memory.operations.sizeInElements(); ++idx) |
| 21 | { |
| 22 | if (memory.operations[idx] == nullptr) |
| 23 | return Result::Error(HttpClientResultCategory, HttpClientError::SchedulerOperationNull); |
| 24 | if (not memory.operations[idx]->isInitialized()) |
| 25 | return Result::Error(HttpClientResultCategory, HttpClientError::SchedulerOperationNotInitialized); |
| 26 | } |
| 27 | |
| 28 | schedulerMemory = memory; |
| 29 | for (size_t idx = 0; idx < schedulerMemory.operations.sizeInElements(); ++idx) |
| 30 | { |
| 31 | schedulerMemory.readyOperations[idx] = 1; |
| 32 | schedulerMemory.operations[idx]->setNotifier(this); |
| 33 | } |
nothing calls this directly
no test coverage detected