| 124 | } |
| 125 | |
| 126 | Result close() |
| 127 | { |
| 128 | if (not initialized) |
| 129 | { |
| 130 | return Result(true); |
| 131 | } |
| 132 | |
| 133 | if (wakeUpStarted and eventLoop != nullptr) |
| 134 | { |
| 135 | (void)wakeUp.stop(*eventLoop); |
| 136 | wakeUpStarted = false; |
| 137 | } |
| 138 | |
| 139 | if (requestBodySink.isStillWriting() or not requestBodySink.hasBeenDestroyed()) |
| 140 | { |
| 141 | requestBodySink.destroy(); |
| 142 | } |
| 143 | responseBodyStream.destroy(); |
| 144 | resetRequestBodyState(); |
| 145 | |
| 146 | SC_TRY(operation.close()); |
| 147 | operation.setNotifier(nullptr); |
| 148 | |
| 149 | eventLoop = nullptr; |
| 150 | requestBodyBuffersPool = nullptr; |
| 151 | initialized = false; |
| 152 | return Result(true); |
| 153 | } |
| 154 | |
| 155 | Result cancel() { return operation.cancel(); } |
| 156 | |