start next request on keep-alive connection
| 545 | |
| 546 | //start next request on keep-alive connection |
| 547 | bool StartNextRequest(THttpRequestRef& req) { |
| 548 | if (Finalized_) { |
| 549 | return false; |
| 550 | } |
| 551 | |
| 552 | { |
| 553 | //thread safe linking connection->request |
| 554 | TGuard<TSpinLock> g(SL_); |
| 555 | Req_ = req; |
| 556 | } |
| 557 | |
| 558 | RequestWritten_ = false; |
| 559 | BeginReadResponse_ = false; |
| 560 | |
| 561 | try { |
| 562 | TErrorCode ec; |
| 563 | SendRequest(req->BuildRequest(), ec); //throw std::bad_alloc |
| 564 | if (ec.Value() == ECANCELED) { |
| 565 | OnCancel(); |
| 566 | } else if (ec) { |
| 567 | OnError(ec); |
| 568 | } |
| 569 | } catch (...) { |
| 570 | OnError(CurrentExceptionMessage()); |
| 571 | throw; |
| 572 | } |
| 573 | return true; |
| 574 | } |
| 575 | |
| 576 | //connection received from cache must be validated before using |
| 577 | //(process removing closed conection from cache consume some time) |
no test coverage detected