11
11
#include < functional>
12
12
#include < network/protocol/http/client/base.hpp>
13
13
#include < network/protocol/http/client/options.hpp>
14
- #include < asio/io_service.hpp>
15
- #include < asio/strand.hpp>
14
+ #include < boost/ asio/io_service.hpp>
15
+ #include < boost/ asio/strand.hpp>
16
16
#include < network/protocol/http/client/connection_manager.hpp>
17
17
#include < network/protocol/http/client/simple_connection_manager.hpp>
18
18
#include < network/protocol/http/request.hpp>
@@ -22,7 +22,7 @@ namespace network { namespace http {
22
22
23
23
struct client_base_pimpl {
24
24
typedef
25
- std::function<void (boost::iterator_range<char const *> const &, asio ::error_code const &)>
25
+ std::function<void (boost::iterator_range<char const *> const &, boost::system ::error_code const &)>
26
26
body_callback_function_type;
27
27
client_base_pimpl (client_options const &options);
28
28
response const request_skeleton (request const & request_,
@@ -34,20 +34,20 @@ struct client_base_pimpl {
34
34
~client_base_pimpl ();
35
35
private:
36
36
client_options options_;
37
- asio::io_service * service_ptr;
38
- boost ::shared_ptr<asio::io_service::work> sentinel_;
39
- boost ::shared_ptr<std::thread> lifetime_thread_;
40
- boost ::shared_ptr<connection_manager> connection_manager_;
37
+ boost:: asio::io_service * service_ptr;
38
+ std ::shared_ptr<boost:: asio::io_service::work> sentinel_;
39
+ std ::shared_ptr<std::thread> lifetime_thread_;
40
+ std ::shared_ptr<connection_manager> connection_manager_;
41
41
bool owned_service_;
42
42
};
43
43
44
44
client_base::client_base ()
45
- : pimpl(new (std::nothrow) client_base_pimpl(client_options())) {
45
+ : pimpl(new client_base_pimpl(client_options())) {
46
46
NETWORK_MESSAGE (" client_base::client_base()" );
47
47
}
48
48
49
49
client_base::client_base (client_options const &options)
50
- : pimpl(new (std::nothrow) client_base_pimpl(options)) {
50
+ : pimpl(new client_base_pimpl(options)) {
51
51
NETWORK_MESSAGE (" client_base::client_base(client_options const &)" );
52
52
}
53
53
@@ -78,17 +78,17 @@ client_base_pimpl::client_base_pimpl(client_options const &options)
78
78
NETWORK_MESSAGE (" client_base_pimpl::client_base_pimpl(client_options const &)" );
79
79
if (service_ptr == 0 ) {
80
80
NETWORK_MESSAGE (" creating owned io_service." );
81
- service_ptr = new (std::nothrow) asio::io_service;
81
+ service_ptr = new boost:: asio::io_service;
82
82
owned_service_ = true ;
83
83
}
84
84
if (!connection_manager_.get ()) {
85
85
NETWORK_MESSAGE (" creating owned simple_connection_manager" );
86
86
connection_manager_.reset (
87
- new (std::nothrow) simple_connection_manager (options));
87
+ new simple_connection_manager (options));
88
88
}
89
- sentinel_.reset (new (std::nothrow) asio::io_service::work (*service_ptr));
89
+ sentinel_.reset (new boost:: asio::io_service::work (*service_ptr));
90
90
auto local_ptr = service_ptr;
91
- lifetime_thread_.reset (new (std::nothrow) std::thread ([local_ptr]() { local_ptr->run (); }));
91
+ lifetime_thread_.reset (new std::thread ([local_ptr]() { local_ptr->run (); }));
92
92
if (!lifetime_thread_.get ())
93
93
BOOST_THROW_EXCEPTION (std::runtime_error (" Cannot allocate client lifetime thread; not enough memory." ));
94
94
}
@@ -114,7 +114,7 @@ response const client_base_pimpl::request_skeleton(
114
114
)
115
115
{
116
116
NETWORK_MESSAGE (" client_base_pimpl::request_skeleton(...)" );
117
- boost ::shared_ptr<client_connection> connection_;
117
+ std ::shared_ptr<client_connection> connection_;
118
118
connection_ = connection_manager_->get_connection (*service_ptr, request_, options_);
119
119
return connection_->send_request (method, request_, get_body, callback, options);
120
120
}
0 commit comments