Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update async_normal.hpp
  • Loading branch information
DanielBujnik committed Aug 13, 2015
commit a3dfcdbc8f91d70696f6ff08706e4f1db152ece1
16 changes: 9 additions & 7 deletions boost/network/protocol/http/client/connection/async_normal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ struct http_async_connection
this->method = method;
boost::uint16_t port_ = port(request);
string_type host_ = host(request);
boost::uint16_t source_port = request.getSourcePort();

resolve_(resolver_, host_, port_,
request_strand_.wrap(boost::bind(
&this_type::handle_resolved, this_type::shared_from_this(),
host_, port_, get_body, callback,
host_, port_, source_port, get_body, callback,
generator, boost::arg<1>(), boost::arg<2>())));
if (timeout_ > 0) {
timer_.expires_from_now(boost::posix_time::seconds(timeout_));
Expand Down Expand Up @@ -129,7 +131,7 @@ struct http_async_connection
is_timedout_ = true;
}

void handle_resolved(string_type host, boost::uint16_t port, bool get_body,
void handle_resolved(string_type host, boost::uint16_t port, boost::uint16_t source_port, bool get_body,
body_callback_function_type callback,
body_generator_function_type generator,
boost::system::error_code const& ec,
Expand All @@ -141,10 +143,10 @@ struct http_async_connection
resolver_iterator iter = boost::begin(endpoint_range);
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
delegate_->connect(
endpoint, host,
endpoint, host, source_port,
request_strand_.wrap(boost::bind(
&this_type::handle_connected, this_type::shared_from_this(), host,
port, get_body, callback, generator,
port, source_port, get_body, callback, generator,
std::make_pair(++iter, resolver_iterator()),
placeholders::error)));
} else {
Expand All @@ -154,7 +156,7 @@ struct http_async_connection
}
}

void handle_connected(string_type host, boost::uint16_t port, bool get_body,
void handle_connected(string_type host, boost::uint16_t port, boost::uint16_t source_port, bool get_body,
body_callback_function_type callback,
body_generator_function_type generator,
resolver_iterator_pair endpoint_range,
Expand All @@ -174,10 +176,10 @@ struct http_async_connection
resolver_iterator iter = boost::begin(endpoint_range);
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
delegate_->connect(
endpoint, host,
endpoint, host, source_port,
request_strand_.wrap(boost::bind(
&this_type::handle_connected, this_type::shared_from_this(),
host, port, get_body, callback, generator,
host, port, source_port, get_body, callback, generator,
std::make_pair(++iter, resolver_iterator()),
placeholders::error)));
} else {
Expand Down