| 288 | } |
| 289 | |
| 290 | void AddRequest(TAutoPtr<TClientRequest> req, bool fail) { |
| 291 | struct TFailRequest: public THttpClientRequestEx { |
| 292 | inline TFailRequest(TAutoPtr<TClientRequest> parent) { |
| 293 | Conn_.Reset(parent->Conn_.Release()); |
| 294 | HttpConn_.Reset(parent->HttpConn_.Release()); |
| 295 | } |
| 296 | |
| 297 | bool Reply(void*) override { |
| 298 | if (!ProcessHeaders()) { |
| 299 | return true; |
| 300 | } |
| 301 | |
| 302 | ProcessFailRequest(0); |
| 303 | return true; |
| 304 | } |
| 305 | }; |
| 306 | |
| 307 | if (!fail && Requests->Add(req.Get())) { |
| 308 | Y_UNUSED(req.Release()); |
| 309 | } else { |
| 310 | req = new TFailRequest(req); |
| 311 | |
| 312 | if (FailRequests->Add(req.Get())) { |
| 313 | Y_UNUSED(req.Release()); |
| 314 | } else { |
| 315 | Cb_->OnFailRequest(-1); |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | size_t GetRequestQueueSize() const { |
| 321 | return Requests->Size(); |
no test coverage detected