|
2 | 2 | #include <atomic>
|
3 | 3 | #include <cassert>
|
4 | 4 | #include <charconv>
|
| 5 | +#include <chrono> |
5 | 6 | #include <cstddef>
|
6 | 7 | #include <filesystem>
|
7 | 8 | #include <fstream>
|
@@ -142,7 +143,8 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
|
142 | 143 | timer_(&executor_wrapper_),
|
143 | 144 | socket_(std::make_shared<socket_t>(executor)),
|
144 | 145 | head_buf_(socket_->head_buf_),
|
145 |
| - chunked_buf_(socket_->chunked_buf_) {} |
| 146 | + chunked_buf_(socket_->chunked_buf_), |
| 147 | + create_tp_(std::chrono::steady_clock::now()) {} |
146 | 148 |
|
147 | 149 | coro_http_client(
|
148 | 150 | coro_io::ExecutorWrapper<> *executor = coro_io::get_global_executor())
|
@@ -182,6 +184,10 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
|
182 | 184 |
|
183 | 185 | ~coro_http_client() { close(); }
|
184 | 186 |
|
| 187 | + auto get_create_time_point() const noexcept { |
| 188 | + return std::chrono::steady_clock::now(); |
| 189 | + } |
| 190 | + |
185 | 191 | void close() {
|
186 | 192 | if (socket_ == nullptr || socket_->has_closed_)
|
187 | 193 | return;
|
@@ -2463,6 +2469,7 @@ class coro_http_client : public std::enable_shared_from_this<coro_http_client> {
|
2463 | 2469 | std::chrono::seconds(30);
|
2464 | 2470 | std::chrono::steady_clock::duration req_timeout_duration_ =
|
2465 | 2471 | std::chrono::seconds(60);
|
| 2472 | + std::chrono::steady_clock::time_point create_tp_; |
2466 | 2473 | bool enable_tcp_no_delay_ = true;
|
2467 | 2474 | std::string resp_chunk_str_;
|
2468 | 2475 | std::span<char> out_buf_;
|
|
0 commit comments