| 94 | HttpClientEvent<MaxListeners, HttpClientResponse&> eventResponseHead; |
| 95 | |
| 96 | Result init(HttpClient& client, T_AsyncEventLoop& loop, const HttpClientOperationMemory& operationMemory, |
| 97 | const HttpClientAsyncOperationMemoryT<T_AsyncStreams>& asyncMemory) |
| 98 | { |
| 99 | SC_TRY_MSG(eventLoop == nullptr, "HttpClientAsyncT: already initialized"); |
| 100 | SC_TRY_MSG(asyncMemory.responseBuffers.sizeInElements() > 0, "HttpClientAsyncT: response buffers missing"); |
| 101 | SC_TRY_MSG(asyncMemory.responseReadQueue.sizeInElements() > 0, "HttpClientAsyncT: response read queue missing"); |
| 102 | SC_TRY_MSG(asyncMemory.requestWriteQueue.sizeInElements() > 0, "HttpClientAsyncT: request write queue missing"); |
| 103 | |
| 104 | eventLoop = &loop; |
| 105 | responseReadQueue = asyncMemory.responseReadQueue; |
| 106 | requestWriteQueue = asyncMemory.requestWriteQueue; |
| 107 | |
| 108 | responseBuffersPool.setBuffers(asyncMemory.responseBuffers); |
| 109 | if (asyncMemory.responseBufferMemory.sizeInBytes() > 0) |
| 110 | { |
| 111 | SC_TRY(T_AsyncBuffersPool::sliceInEqualParts(asyncMemory.responseBuffers, asyncMemory.responseBufferMemory, |
| 112 | asyncMemory.responseBuffers.sizeInElements())); |
| 113 | } |
| 114 | |
| 115 | responseBodyStream.setReadQueue(responseReadQueue); |
| 116 | responseBodyStream.setAutoDestroy(false); |
| 117 | requestBodySink.setAutoDestroy(false); |
| 118 | wakeUp.callback = [this](typename T_AsyncLoopWakeUp::Result& result) { onWakeUp(result); }; |
| 119 | |
| 120 | SC_TRY(operation.init(client, operationMemory)); |
| 121 | operation.setNotifier(this); |
| 122 | initialized = true; |
| 123 | return Result(true); |
| 124 | } |
| 125 | |
| 126 | Result close() |
| 127 | { |
no test coverage detected