Skip to content

Found every instance of the 'asio' namespace, and qualified them unambiguously. #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 7 additions & 7 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct async_client

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
std::shared_ptr<asio::io_service> service,
std::shared_ptr<::asio::io_service> service,
optional<string_type> certificate_filename,
optional<string_type> verify_path,
optional<string_type> certificate_file,
Expand All @@ -48,10 +48,10 @@ struct async_client
optional<string_type> sni_hostname, long ssl_options)
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get() ? service
: std::make_shared<asio::io_service>()),
: std::make_shared<::asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
sentinel_(new asio::io_service::work(service_)),
sentinel_(new ::asio::io_service::work(service_)),
certificate_filename_(std::move(certificate_filename)),
verify_path_(std::move(verify_path)),
certificate_file_(std::move(certificate_file)),
Expand All @@ -61,7 +61,7 @@ struct async_client
ssl_options_(ssl_options),
always_verify_peer_(always_verify_peer) {
connection_base::resolver_strand_.reset(
new asio::io_service::strand(service_));
new ::asio::io_service::strand(service_));
if (!service)
lifetime_thread_.reset(new std::thread([this]() { service_.run(); }));
}
Expand Down Expand Up @@ -89,10 +89,10 @@ struct async_client
generator);
}

std::shared_ptr<asio::io_service> service_ptr;
asio::io_service& service_;
std::shared_ptr<::asio::io_service> service_ptr;
::asio::io_service& service_;
resolver_type resolver_;
std::shared_ptr<asio::io_service::work> sentinel_;
std::shared_ptr<::asio::io_service::work> sentinel_;
std::shared_ptr<std::thread> lifetime_thread_;
optional<string_type> certificate_filename_;
optional<string_type> verify_path_;
Expand Down
42 changes: 21 additions & 21 deletions boost/network/protocol/http/client/connection/async_normal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace impl {
template <class Tag, unsigned version_major, unsigned version_minor>
struct async_connection_base;

namespace placeholders = asio::placeholders;
namespace placeholders = ::asio::placeholders;

template <class Tag, unsigned version_major, unsigned version_minor>
struct http_async_connection
Expand Down Expand Up @@ -145,7 +145,7 @@ struct http_async_connection
// Here we deal with the case that there was an error encountered and
// that there's still more endpoints to try connecting to.
resolver_iterator iter = boost::begin(endpoint_range);
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
::asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
auto self = this->shared_from_this();
delegate_->connect(
endpoint, host, source_port,
Expand All @@ -155,7 +155,7 @@ struct http_async_connection
generator, std::make_pair(++iter_copy, resolver_iterator()), ec);
}));
} else {
set_errors(ec ? ec : asio::error::host_not_found);
set_errors(ec ? ec : ::asio::error::host_not_found);
boost::iterator_range<const char*> range;
if (callback) callback(range, ec);
}
Expand All @@ -168,7 +168,7 @@ struct http_async_connection
resolver_iterator_pair endpoint_range,
std::error_code const& ec) {
if (is_timedout_) {
set_errors(asio::error::timed_out);
set_errors(::asio::error::timed_out);
} else if (!ec) {
BOOST_ASSERT(delegate_.get() != 0);
auto self = this->shared_from_this();
Expand All @@ -182,7 +182,7 @@ struct http_async_connection
} else {
if (!boost::empty(endpoint_range)) {
resolver_iterator iter = boost::begin(endpoint_range);
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
::asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
auto self = this->shared_from_this();
delegate_->connect(
endpoint, host, source_port,
Expand All @@ -193,7 +193,7 @@ struct http_async_connection
ec);
}));
} else {
set_errors(ec ? ec : asio::error::host_not_found);
set_errors(ec ? ec : ::asio::error::host_not_found);
boost::iterator_range<const char*> range;
if (callback) callback(range, ec);
}
Expand Down Expand Up @@ -231,15 +231,15 @@ struct http_async_connection

auto self = this->shared_from_this();
delegate_->read_some(
asio::mutable_buffers_1(this->part.data(),
::asio::mutable_buffers_1(this->part.data(),
this->part.size()),
request_strand_.wrap([=] (std::error_code const &ec,
std::size_t bytes_transferred) {
self->handle_received_data(version, get_body, callback,
ec, bytes_transferred);
}));
} else {
set_errors(is_timedout_ ? asio::error::timed_out : ec);
set_errors(is_timedout_ ? ::asio::error::timed_out : ec);
}
}

Expand All @@ -250,19 +250,19 @@ struct http_async_connection
static const long short_read_error = 335544539;
bool is_ssl_short_read_error =
#ifdef BOOST_NETWORK_ENABLE_HTTPS
ec.category() == asio::error::ssl_category &&
ec.category() == ::asio::error::ssl_category &&
ec.value() == short_read_error;
#else
false && short_read_error;
#endif
if (!is_timedout_ &&
(!ec || ec == asio::error::eof || is_ssl_short_read_error)) {
(!ec || ec == ::asio::error::eof || is_ssl_short_read_error)) {
logic::tribool parsed_ok;
size_t remainder;
auto self = this->shared_from_this();
switch (state) {
case version:
if (ec == asio::error::eof) return;
if (ec == ::asio::error::eof) return;
parsed_ok = this->parse_version(
delegate_,
request_strand_.wrap([=] (std::error_code const &ec,
Expand All @@ -275,7 +275,7 @@ struct http_async_connection
return;
}
case status:
if (ec == asio::error::eof) return;
if (ec == ::asio::error::eof) return;
parsed_ok = this->parse_status(
delegate_,
request_strand_.wrap([=] (std::error_code const &ec,
Expand All @@ -288,7 +288,7 @@ struct http_async_connection
return;
}
case status_message:
if (ec == asio::error::eof) return;
if (ec == ::asio::error::eof) return;
parsed_ok = this->parse_status_message(
delegate_, request_strand_.wrap([=] (std::error_code const &,
std::size_t bytes_transferred) {
Expand All @@ -300,7 +300,7 @@ struct http_async_connection
return;
}
case headers:
if (ec == asio::error::eof) return;
if (ec == ::asio::error::eof) return;
// In the following, remainder is the number of bytes that remain in
// the buffer. We need this in the body processing to make sure that
// the data remaining in the buffer is dealt with before another call
Expand Down Expand Up @@ -352,7 +352,7 @@ struct http_async_connection

auto self = this->shared_from_this();
delegate_->read_some(
asio::mutable_buffers_1(this->part.data(),
::asio::mutable_buffers_1(this->part.data(),
this->part.size()),
request_strand_.wrap([=] (std::error_code const &ec,
std::size_t bytes_transferred) {
Expand All @@ -374,7 +374,7 @@ struct http_async_connection
}
return;
case body:
if (ec == asio::error::eof || is_ssl_short_read_error) {
if (ec == ::asio::error::eof || is_ssl_short_read_error) {
// Here we're handling the case when the connection has been closed
// from the server side, or at least that the end of file has been
// reached while reading the socket. This signals the end of the
Expand Down Expand Up @@ -420,7 +420,7 @@ struct http_async_connection
callback(make_iterator_range(begin, end), ec);
auto self = this->shared_from_this();
delegate_->read_some(
asio::mutable_buffers_1(this->part.data(),
::asio::mutable_buffers_1(this->part.data(),
this->part.size()),
request_strand_.wrap([=] (std::error_code const &ec,
std::size_t bytes_transferred) {
Expand All @@ -446,7 +446,7 @@ struct http_async_connection
BOOST_ASSERT(false && "Bug, report this to the developers!");
}
} else {
std::system_error error(is_timedout_ ? asio::error::timed_out
std::system_error error(is_timedout_ ? ::asio::error::timed_out
: ec);
this->source_promise.set_exception(std::make_exception_ptr(error));
this->destination_promise.set_exception(std::make_exception_ptr(error));
Expand Down Expand Up @@ -506,14 +506,14 @@ struct http_async_connection
}

int timeout_;
asio::deadline_timer timer_;
::asio::deadline_timer timer_;
bool is_timedout_;
bool follow_redirect_;
resolver_type& resolver_;
resolve_function resolve_;
asio::io_service::strand request_strand_;
::asio::io_service::strand request_strand_;
connection_delegate_ptr delegate_;
asio::streambuf command_streambuf;
::asio::streambuf command_streambuf;
string_type method;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ struct http_async_protocol_handler {
std::end(result_range));
part_begin = part.begin();
delegate_->read_some(
asio::mutable_buffers_1(part.data(), part.size()),
::asio::mutable_buffers_1(part.data(), part.size()),
callback);
}
return parsed_ok;
Expand Down Expand Up @@ -185,7 +185,7 @@ struct http_async_protocol_handler {
std::end(result_range));
part_begin = part.begin();
delegate_->read_some(
asio::mutable_buffers_1(part.data(), part.size()),
::asio::mutable_buffers_1(part.data(), part.size()),
callback);
}
return parsed_ok;
Expand Down Expand Up @@ -230,7 +230,7 @@ struct http_async_protocol_handler {
std::end(result_range));
part_begin = part.begin();
delegate_->read_some(
asio::mutable_buffers_1(part.data(), part.size()),
::asio::mutable_buffers_1(part.data(), part.size()),
callback);
}
return parsed_ok;
Expand Down Expand Up @@ -317,7 +317,7 @@ struct http_async_protocol_handler {
std::end(result_range));
part_begin = part.begin();
delegate_->read_some(
asio::mutable_buffers_1(part.data(), part.size()),
::asio::mutable_buffers_1(part.data(), part.size()),
callback);
}
return std::make_tuple(
Expand All @@ -331,7 +331,7 @@ struct http_async_protocol_handler {
partial_parsed.append(part_begin, bytes);
part_begin = part.begin();
delegate_->read_some(
asio::mutable_buffers_1(part.data(), part.size()), callback);
::asio::mutable_buffers_1(part.data(), part.size()), callback);
}

typedef response_parser<Tag> response_parser_type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ namespace http {
namespace impl {

struct connection_delegate {
virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
virtual void connect(::asio::ip::tcp::endpoint &endpoint, std::string host,
std::uint16_t source_port,
std::function<void(std::error_code const &)> handler) = 0;
virtual void write(
asio::streambuf &command_streambuf,
::asio::streambuf &command_streambuf,
std::function<void(std::error_code const &, size_t)> handler) = 0;
virtual void read_some(
asio::mutable_buffers_1 const &read_buffer,
::asio::mutable_buffers_1 const &read_buffer,
std::function<void(std::error_code const &, size_t)> handler) = 0;
virtual void disconnect() = 0;
virtual ~connection_delegate() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct connection_delegate_factory {
// This is the factory method that actually returns the delegate instance.
// TODO(dberris): Support passing in proxy settings when crafting connections.
static connection_delegate_ptr new_connection_delegate(
asio::io_service& service, bool https, bool always_verify_peer,
::asio::io_service& service, bool https, bool always_verify_peer,
optional<string_type> certificate_filename,
optional<string_type> verify_path, optional<string_type> certificate_file,
optional<string_type> private_key_file, optional<string_type> ciphers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ namespace http {
namespace impl {

struct normal_delegate : connection_delegate {
explicit normal_delegate(asio::io_service &service);
explicit normal_delegate(::asio::io_service &service);

void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
void connect(::asio::ip::tcp::endpoint &endpoint, std::string host,
std::uint16_t source_port,
std::function<void(std::error_code const &)> handler) override;
void write(asio::streambuf &command_streambuf,
void write(::asio::streambuf &command_streambuf,
std::function<void(std::error_code const &, size_t)> handler)
override;
void read_some(asio::mutable_buffers_1 const &read_buffer,
void read_some(::asio::mutable_buffers_1 const &read_buffer,
std::function<void(std::error_code const &, size_t)> handler)
override;
void disconnect() override;
Expand All @@ -40,8 +40,8 @@ struct normal_delegate : connection_delegate {
normal_delegate &operator=(normal_delegate) = delete;

private:
asio::io_service &service_;
std::unique_ptr<asio::ip::tcp::socket> socket_;
::asio::io_service &service_;
std::unique_ptr<::asio::ip::tcp::socket> socket_;
};

} // namespace impl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@
#include <boost/network/protocol/http/client/connection/normal_delegate.hpp>

boost::network::http::impl::normal_delegate::normal_delegate(
asio::io_service &service)
::asio::io_service &service)
: service_(service) {}

void boost::network::http::impl::normal_delegate::connect(
asio::ip::tcp::endpoint &endpoint, std::string host,
::asio::ip::tcp::endpoint &endpoint, std::string host,
std::uint16_t source_port,
std::function<void(std::error_code const &)> handler) {

// TODO(dberris): review parameter necessity.
(void)host;

socket_.reset(new asio::ip::tcp::socket(
socket_.reset(new ::asio::ip::tcp::socket(
service_,
asio::ip::tcp::endpoint(asio::ip::address(), source_port)));
::asio::ip::tcp::endpoint(::asio::ip::address(), source_port)));
socket_->async_connect(endpoint, handler);
}

void boost::network::http::impl::normal_delegate::write(
asio::streambuf &command_streambuf,
::asio::streambuf &command_streambuf,
std::function<void(std::error_code const &, size_t)> handler) {
asio::async_write(*socket_, command_streambuf, handler);
::asio::async_write(*socket_, command_streambuf, handler);
}

void boost::network::http::impl::normal_delegate::read_some(
asio::mutable_buffers_1 const &read_buffer,
::asio::mutable_buffers_1 const &read_buffer,
std::function<void(std::error_code const &, size_t)> handler) {
socket_->async_read_some(read_buffer, handler);
}

void boost::network::http::impl::normal_delegate::disconnect() {
if (socket_.get() && socket_->is_open()) {
std::error_code ignored;
socket_->shutdown(asio::ip::tcp::socket::shutdown_both, ignored);
socket_->shutdown(::asio::ip::tcp::socket::shutdown_both, ignored);
if (!ignored) {
socket_->close(ignored);
}
Expand Down
Loading