Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit216613c

Browse files
chenzhaoyudeanberris
authored andcommitted
fix http client timeout (#763)
1 parent092cd57 commit216613c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎boost/network/protocol/http/client/connection/async_normal.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,19 @@ struct http_async_connection
177177
std::uint16_t source_port = request.source_port();
178178

179179
auto self =this->shared_from_this();
180+
if (timeout_ >0) {
181+
timer_.expires_from_now(std::chrono::seconds(timeout_));
182+
timer_.async_wait(request_strand_.wrap([=] (boost::system::error_codeconst &ec) {
183+
self->handle_timeout(ec);
184+
}));
185+
}
180186
resolve_(resolver_, host_, port_,
181187
request_strand_.wrap(
182188
[=] (boost::system::error_codeconst &ec,
183189
resolver_iterator_pair endpoint_range) {
184190
self->handle_resolved(host_, port_, source_port, get_body,
185191
callback, generator, ec, endpoint_range);
186192
}));
187-
if (timeout_ >0) {
188-
timer_.expires_from_now(std::chrono::seconds(timeout_));
189-
timer_.async_wait(request_strand_.wrap([=] (boost::system::error_codeconst &ec) {
190-
self->handle_timeout(ec);
191-
}));
192-
}
193193
return response_;
194194
}
195195

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp