| 1118 | } |
| 1119 | |
| 1120 | void THttpConn::OnError(const TString& errText) { |
| 1121 | Finalized_ = true; |
| 1122 | if (Connected_) { |
| 1123 | Connected_ = false; |
| 1124 | TErrorCode ec; |
| 1125 | AS_.Shutdown(NAsio::TTcpSocket::ShutdownBoth, ec); |
| 1126 | } else { |
| 1127 | if (AS_.IsOpen()) { |
| 1128 | AS_.AsyncCancel(); |
| 1129 | } |
| 1130 | } |
| 1131 | THttpRequestRef r(ReleaseRequest()); |
| 1132 | if (!!r) { |
| 1133 | r->OnError(this, errText); |
| 1134 | } else { |
| 1135 | if (Cached_) { |
| 1136 | size_t res = HttpConnManager()->OnConnError(AddrId_); |
| 1137 | Y_UNUSED(res); |
| 1138 | #ifdef DEBUG_STAT |
| 1139 | TDebugStat::ConnDestroyedInCache += res; |
| 1140 | #endif |
| 1141 | } |
| 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | void THttpRequest::Run(THttpRequestRef& req) { |
| 1146 | #ifdef DEBUG_STAT |
no test coverage detected