it seems we have lost TCP SYN packet, create extra connection for decrease response time
| 1173 | |
| 1174 | //it seems we have lost TCP SYN packet, create extra connection for decrease response time |
| 1175 | void THttpRequest::OnDetectSlowConnecting() { |
| 1176 | #ifdef DEBUG_STAT |
| 1177 | ++TDebugStat::ConnSlow; |
| 1178 | #endif |
| 1179 | //use some io_service (Run() thread-executor), from first conn. for more thread safety |
| 1180 | THttpConnRef conn = GetConn(); |
| 1181 | |
| 1182 | if (!conn) { |
| 1183 | return; |
| 1184 | } |
| 1185 | |
| 1186 | THttpConnRef conn2; |
| 1187 | try { |
| 1188 | conn2 = THttpConn::Create(conn->GetIOService()); |
| 1189 | } catch (...) { |
| 1190 | return; // cant create spare connection, simple continue use only main |
| 1191 | } |
| 1192 | |
| 1193 | { |
| 1194 | TGuard<TSpinLock> g(SL_); |
| 1195 | Conn2_ = conn2; |
| 1196 | } |
| 1197 | |
| 1198 | if (Y_UNLIKELY(Canceled_)) { |
| 1199 | ReleaseConn2(); |
| 1200 | } else { |
| 1201 | //use connect timeout for disable detecting slow connecting on second conn. |
| 1202 | TEndpoint ep(new NAddr::TAddrInfo(&*Addr_->Addr.Begin())); |
| 1203 | try { |
| 1204 | conn2->StartRequest(WeakThis_, ep, Addr_->Id, THttp2Options::ConnectTimeout); |
| 1205 | } catch (...) { |
| 1206 | // ignore errors on spare connection |
| 1207 | ReleaseConn2(); |
| 1208 | } |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | void THttpRequest::OnConnect(THttpConn* c) { |
| 1213 | THttpConnRef extraConn; |
no test coverage detected