Skip to content

Commit f2095b6

Browse files
committed
Merge pull request cpp-netlib#638 from glynos/asio_namespace_fix
Found every instance of the 'asio' namespace, and qualified them unambiguously.
2 parents b5a0f30 + 3bada94 commit f2095b6

28 files changed

+208
-208
lines changed

boost/network/protocol/http/client/async_impl.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct async_client
3939

4040
async_client(bool cache_resolved, bool follow_redirect,
4141
bool always_verify_peer, int timeout,
42-
std::shared_ptr<asio::io_service> service,
42+
std::shared_ptr<::asio::io_service> service,
4343
optional<string_type> certificate_filename,
4444
optional<string_type> verify_path,
4545
optional<string_type> certificate_file,
@@ -48,10 +48,10 @@ struct async_client
4848
optional<string_type> sni_hostname, long ssl_options)
4949
: connection_base(cache_resolved, follow_redirect, timeout),
5050
service_ptr(service.get() ? service
51-
: std::make_shared<asio::io_service>()),
51+
: std::make_shared<::asio::io_service>()),
5252
service_(*service_ptr),
5353
resolver_(service_),
54-
sentinel_(new asio::io_service::work(service_)),
54+
sentinel_(new ::asio::io_service::work(service_)),
5555
certificate_filename_(std::move(certificate_filename)),
5656
verify_path_(std::move(verify_path)),
5757
certificate_file_(std::move(certificate_file)),
@@ -61,7 +61,7 @@ struct async_client
6161
ssl_options_(ssl_options),
6262
always_verify_peer_(always_verify_peer) {
6363
connection_base::resolver_strand_.reset(
64-
new asio::io_service::strand(service_));
64+
new ::asio::io_service::strand(service_));
6565
if (!service)
6666
lifetime_thread_.reset(new std::thread([this]() { service_.run(); }));
6767
}
@@ -89,10 +89,10 @@ struct async_client
8989
generator);
9090
}
9191

92-
std::shared_ptr<asio::io_service> service_ptr;
93-
asio::io_service& service_;
92+
std::shared_ptr<::asio::io_service> service_ptr;
93+
::asio::io_service& service_;
9494
resolver_type resolver_;
95-
std::shared_ptr<asio::io_service::work> sentinel_;
95+
std::shared_ptr<::asio::io_service::work> sentinel_;
9696
std::shared_ptr<std::thread> lifetime_thread_;
9797
optional<string_type> certificate_filename_;
9898
optional<string_type> verify_path_;

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

+21-21
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace impl {
4040
template <class Tag, unsigned version_major, unsigned version_minor>
4141
struct async_connection_base;
4242

43-
namespace placeholders = asio::placeholders;
43+
namespace placeholders = ::asio::placeholders;
4444

4545
template <class Tag, unsigned version_major, unsigned version_minor>
4646
struct http_async_connection
@@ -145,7 +145,7 @@ struct http_async_connection
145145
// Here we deal with the case that there was an error encountered and
146146
// that there's still more endpoints to try connecting to.
147147
resolver_iterator iter = boost::begin(endpoint_range);
148-
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
148+
::asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
149149
auto self = this->shared_from_this();
150150
delegate_->connect(
151151
endpoint, host, source_port,
@@ -155,7 +155,7 @@ struct http_async_connection
155155
generator, std::make_pair(++iter_copy, resolver_iterator()), ec);
156156
}));
157157
} else {
158-
set_errors(ec ? ec : asio::error::host_not_found);
158+
set_errors(ec ? ec : ::asio::error::host_not_found);
159159
boost::iterator_range<const char*> range;
160160
if (callback) callback(range, ec);
161161
}
@@ -168,7 +168,7 @@ struct http_async_connection
168168
resolver_iterator_pair endpoint_range,
169169
std::error_code const& ec) {
170170
if (is_timedout_) {
171-
set_errors(asio::error::timed_out);
171+
set_errors(::asio::error::timed_out);
172172
} else if (!ec) {
173173
BOOST_ASSERT(delegate_.get() != 0);
174174
auto self = this->shared_from_this();
@@ -182,7 +182,7 @@ struct http_async_connection
182182
} else {
183183
if (!boost::empty(endpoint_range)) {
184184
resolver_iterator iter = boost::begin(endpoint_range);
185-
asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
185+
::asio::ip::tcp::endpoint endpoint(iter->endpoint().address(), port);
186186
auto self = this->shared_from_this();
187187
delegate_->connect(
188188
endpoint, host, source_port,
@@ -193,7 +193,7 @@ struct http_async_connection
193193
ec);
194194
}));
195195
} else {
196-
set_errors(ec ? ec : asio::error::host_not_found);
196+
set_errors(ec ? ec : ::asio::error::host_not_found);
197197
boost::iterator_range<const char*> range;
198198
if (callback) callback(range, ec);
199199
}
@@ -231,15 +231,15 @@ struct http_async_connection
231231

232232
auto self = this->shared_from_this();
233233
delegate_->read_some(
234-
asio::mutable_buffers_1(this->part.data(),
234+
::asio::mutable_buffers_1(this->part.data(),
235235
this->part.size()),
236236
request_strand_.wrap([=] (std::error_code const &ec,
237237
std::size_t bytes_transferred) {
238238
self->handle_received_data(version, get_body, callback,
239239
ec, bytes_transferred);
240240
}));
241241
} else {
242-
set_errors(is_timedout_ ? asio::error::timed_out : ec);
242+
set_errors(is_timedout_ ? ::asio::error::timed_out : ec);
243243
}
244244
}
245245

@@ -250,19 +250,19 @@ struct http_async_connection
250250
static const long short_read_error = 335544539;
251251
bool is_ssl_short_read_error =
252252
#ifdef BOOST_NETWORK_ENABLE_HTTPS
253-
ec.category() == asio::error::ssl_category &&
253+
ec.category() == ::asio::error::ssl_category &&
254254
ec.value() == short_read_error;
255255
#else
256256
false && short_read_error;
257257
#endif
258258
if (!is_timedout_ &&
259-
(!ec || ec == asio::error::eof || is_ssl_short_read_error)) {
259+
(!ec || ec == ::asio::error::eof || is_ssl_short_read_error)) {
260260
logic::tribool parsed_ok;
261261
size_t remainder;
262262
auto self = this->shared_from_this();
263263
switch (state) {
264264
case version:
265-
if (ec == asio::error::eof) return;
265+
if (ec == ::asio::error::eof) return;
266266
parsed_ok = this->parse_version(
267267
delegate_,
268268
request_strand_.wrap([=] (std::error_code const &ec,
@@ -275,7 +275,7 @@ struct http_async_connection
275275
return;
276276
}
277277
case status:
278-
if (ec == asio::error::eof) return;
278+
if (ec == ::asio::error::eof) return;
279279
parsed_ok = this->parse_status(
280280
delegate_,
281281
request_strand_.wrap([=] (std::error_code const &ec,
@@ -288,7 +288,7 @@ struct http_async_connection
288288
return;
289289
}
290290
case status_message:
291-
if (ec == asio::error::eof) return;
291+
if (ec == ::asio::error::eof) return;
292292
parsed_ok = this->parse_status_message(
293293
delegate_, request_strand_.wrap([=] (std::error_code const &,
294294
std::size_t bytes_transferred) {
@@ -300,7 +300,7 @@ struct http_async_connection
300300
return;
301301
}
302302
case headers:
303-
if (ec == asio::error::eof) return;
303+
if (ec == ::asio::error::eof) return;
304304
// In the following, remainder is the number of bytes that remain in
305305
// the buffer. We need this in the body processing to make sure that
306306
// the data remaining in the buffer is dealt with before another call
@@ -352,7 +352,7 @@ struct http_async_connection
352352

353353
auto self = this->shared_from_this();
354354
delegate_->read_some(
355-
asio::mutable_buffers_1(this->part.data(),
355+
::asio::mutable_buffers_1(this->part.data(),
356356
this->part.size()),
357357
request_strand_.wrap([=] (std::error_code const &ec,
358358
std::size_t bytes_transferred) {
@@ -374,7 +374,7 @@ struct http_async_connection
374374
}
375375
return;
376376
case body:
377-
if (ec == asio::error::eof || is_ssl_short_read_error) {
377+
if (ec == ::asio::error::eof || is_ssl_short_read_error) {
378378
// Here we're handling the case when the connection has been closed
379379
// from the server side, or at least that the end of file has been
380380
// reached while reading the socket. This signals the end of the
@@ -420,7 +420,7 @@ struct http_async_connection
420420
callback(make_iterator_range(begin, end), ec);
421421
auto self = this->shared_from_this();
422422
delegate_->read_some(
423-
asio::mutable_buffers_1(this->part.data(),
423+
::asio::mutable_buffers_1(this->part.data(),
424424
this->part.size()),
425425
request_strand_.wrap([=] (std::error_code const &ec,
426426
std::size_t bytes_transferred) {
@@ -446,7 +446,7 @@ struct http_async_connection
446446
BOOST_ASSERT(false && "Bug, report this to the developers!");
447447
}
448448
} else {
449-
std::system_error error(is_timedout_ ? asio::error::timed_out
449+
std::system_error error(is_timedout_ ? ::asio::error::timed_out
450450
: ec);
451451
this->source_promise.set_exception(std::make_exception_ptr(error));
452452
this->destination_promise.set_exception(std::make_exception_ptr(error));
@@ -506,14 +506,14 @@ struct http_async_connection
506506
}
507507

508508
int timeout_;
509-
asio::deadline_timer timer_;
509+
::asio::deadline_timer timer_;
510510
bool is_timedout_;
511511
bool follow_redirect_;
512512
resolver_type& resolver_;
513513
resolve_function resolve_;
514-
asio::io_service::strand request_strand_;
514+
::asio::io_service::strand request_strand_;
515515
connection_delegate_ptr delegate_;
516-
asio::streambuf command_streambuf;
516+
::asio::streambuf command_streambuf;
517517
string_type method;
518518
};
519519

boost/network/protocol/http/client/connection/async_protocol_handler.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ struct http_async_protocol_handler {
139139
std::end(result_range));
140140
part_begin = part.begin();
141141
delegate_->read_some(
142-
asio::mutable_buffers_1(part.data(), part.size()),
142+
::asio::mutable_buffers_1(part.data(), part.size()),
143143
callback);
144144
}
145145
return parsed_ok;
@@ -185,7 +185,7 @@ struct http_async_protocol_handler {
185185
std::end(result_range));
186186
part_begin = part.begin();
187187
delegate_->read_some(
188-
asio::mutable_buffers_1(part.data(), part.size()),
188+
::asio::mutable_buffers_1(part.data(), part.size()),
189189
callback);
190190
}
191191
return parsed_ok;
@@ -230,7 +230,7 @@ struct http_async_protocol_handler {
230230
std::end(result_range));
231231
part_begin = part.begin();
232232
delegate_->read_some(
233-
asio::mutable_buffers_1(part.data(), part.size()),
233+
::asio::mutable_buffers_1(part.data(), part.size()),
234234
callback);
235235
}
236236
return parsed_ok;
@@ -317,7 +317,7 @@ struct http_async_protocol_handler {
317317
std::end(result_range));
318318
part_begin = part.begin();
319319
delegate_->read_some(
320-
asio::mutable_buffers_1(part.data(), part.size()),
320+
::asio::mutable_buffers_1(part.data(), part.size()),
321321
callback);
322322
}
323323
return std::make_tuple(
@@ -331,7 +331,7 @@ struct http_async_protocol_handler {
331331
partial_parsed.append(part_begin, bytes);
332332
part_begin = part.begin();
333333
delegate_->read_some(
334-
asio::mutable_buffers_1(part.data(), part.size()), callback);
334+
::asio::mutable_buffers_1(part.data(), part.size()), callback);
335335
}
336336

337337
typedef response_parser<Tag> response_parser_type;

boost/network/protocol/http/client/connection/connection_delegate.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ namespace http {
1818
namespace impl {
1919

2020
struct connection_delegate {
21-
virtual void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
21+
virtual void connect(::asio::ip::tcp::endpoint &endpoint, std::string host,
2222
std::uint16_t source_port,
2323
std::function<void(std::error_code const &)> handler) = 0;
2424
virtual void write(
25-
asio::streambuf &command_streambuf,
25+
::asio::streambuf &command_streambuf,
2626
std::function<void(std::error_code const &, size_t)> handler) = 0;
2727
virtual void read_some(
28-
asio::mutable_buffers_1 const &read_buffer,
28+
::asio::mutable_buffers_1 const &read_buffer,
2929
std::function<void(std::error_code const &, size_t)> handler) = 0;
3030
virtual void disconnect() = 0;
3131
virtual ~connection_delegate() = default;

boost/network/protocol/http/client/connection/connection_delegate_factory.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct connection_delegate_factory {
3434
// This is the factory method that actually returns the delegate instance.
3535
// TODO(dberris): Support passing in proxy settings when crafting connections.
3636
static connection_delegate_ptr new_connection_delegate(
37-
asio::io_service& service, bool https, bool always_verify_peer,
37+
::asio::io_service& service, bool https, bool always_verify_peer,
3838
optional<string_type> certificate_filename,
3939
optional<string_type> verify_path, optional<string_type> certificate_file,
4040
optional<string_type> private_key_file, optional<string_type> ciphers,

boost/network/protocol/http/client/connection/normal_delegate.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ namespace http {
2222
namespace impl {
2323

2424
struct normal_delegate : connection_delegate {
25-
explicit normal_delegate(asio::io_service &service);
25+
explicit normal_delegate(::asio::io_service &service);
2626

27-
void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
27+
void connect(::asio::ip::tcp::endpoint &endpoint, std::string host,
2828
std::uint16_t source_port,
2929
std::function<void(std::error_code const &)> handler) override;
30-
void write(asio::streambuf &command_streambuf,
30+
void write(::asio::streambuf &command_streambuf,
3131
std::function<void(std::error_code const &, size_t)> handler)
3232
override;
33-
void read_some(asio::mutable_buffers_1 const &read_buffer,
33+
void read_some(::asio::mutable_buffers_1 const &read_buffer,
3434
std::function<void(std::error_code const &, size_t)> handler)
3535
override;
3636
void disconnect() override;
@@ -40,8 +40,8 @@ struct normal_delegate : connection_delegate {
4040
normal_delegate &operator=(normal_delegate) = delete;
4141

4242
private:
43-
asio::io_service &service_;
44-
std::unique_ptr<asio::ip::tcp::socket> socket_;
43+
::asio::io_service &service_;
44+
std::unique_ptr<::asio::ip::tcp::socket> socket_;
4545
};
4646

4747
} // namespace impl

boost/network/protocol/http/client/connection/normal_delegate.ipp

+8-8
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@
1616
#include <boost/network/protocol/http/client/connection/normal_delegate.hpp>
1717

1818
boost::network::http::impl::normal_delegate::normal_delegate(
19-
asio::io_service &service)
19+
::asio::io_service &service)
2020
: service_(service) {}
2121

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

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

30-
socket_.reset(new asio::ip::tcp::socket(
30+
socket_.reset(new ::asio::ip::tcp::socket(
3131
service_,
32-
asio::ip::tcp::endpoint(asio::ip::address(), source_port)));
32+
::asio::ip::tcp::endpoint(::asio::ip::address(), source_port)));
3333
socket_->async_connect(endpoint, handler);
3434
}
3535

3636
void boost::network::http::impl::normal_delegate::write(
37-
asio::streambuf &command_streambuf,
37+
::asio::streambuf &command_streambuf,
3838
std::function<void(std::error_code const &, size_t)> handler) {
39-
asio::async_write(*socket_, command_streambuf, handler);
39+
::asio::async_write(*socket_, command_streambuf, handler);
4040
}
4141

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

4848
void boost::network::http::impl::normal_delegate::disconnect() {
4949
if (socket_.get() && socket_->is_open()) {
5050
std::error_code ignored;
51-
socket_->shutdown(asio::ip::tcp::socket::shutdown_both, ignored);
51+
socket_->shutdown(::asio::ip::tcp::socket::shutdown_both, ignored);
5252
if (!ignored) {
5353
socket_->close(ignored);
5454
}

0 commit comments

Comments
 (0)