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

Commit5531b2d

Browse files
committed
Use std::shared_ptr properly for libc++ compatibility
1 parente5016be commit5531b2d

File tree

3 files changed

+25
-36
lines changed

3 files changed

+25
-36
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ struct async_connection_base {
5050
typedef http_async_connection<Tag, version_major, version_minor>
5151
async_connection;
5252
typedeftypename delegate_factory<Tag>::type delegate_factory_type;
53-
connection_ptr temp;
54-
temp.reset(newasync_connection(
55-
resolver, resolve, follow_redirect, timeout,
56-
delegate_factory_type::new_connection_delegate(
57-
resolver.get_io_service(), https, always_verify_peer,
58-
certificate_filename, verify_path, certificate_file,
59-
private_key_file, ciphers, ssl_options)));
60-
BOOST_ASSERT(temp.get() !=0);
53+
auto delegate =delegate_factory_type::new_connection_delegate(
54+
resolver.get_io_service(), https, always_verify_peer,
55+
certificate_filename, verify_path, certificate_file, private_key_file,
56+
ciphers, ssl_options);
57+
auto temp = std::make_shared<async_connection>(
58+
resolver, resolve, follow_redirect, timeout,std::move(delegate));
59+
BOOST_ASSERT(temp !=nullptr);
6160
return temp;
6261
}
6362

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ struct connection_delegate_factory {
3131
typedef std::shared_ptr<connection_delegate> connection_delegate_ptr;
3232
typedeftypename string<Tag>::type string_type;
3333

34-
// This is the factory method that actually returns the delegate
35-
// instance.
34+
// This is the factory method that actually returns the delegate instance.
3635
// TODO(dberris): Support passing in proxy settings when crafting connections.
3736
static connection_delegate_ptrnew_connection_delegate(
3837
asio::io_service& service,bool https,bool always_verify_peer,
@@ -43,27 +42,23 @@ struct connection_delegate_factory {
4342
connection_delegate_ptr delegate;
4443
if (https) {
4544
#ifdef BOOST_NETWORK_ENABLE_HTTPS
46-
delegate.reset(newssl_delegate(
45+
delegate = std::make_shared<ssl_delegate>(
4746
service, always_verify_peer, certificate_filename, verify_path,
48-
certificate_file, private_key_file, ciphers, ssl_options));
47+
certificate_file, private_key_file, ciphers, ssl_options);
4948
#else
5049
BOOST_THROW_EXCEPTION(std::runtime_error("HTTPS not supported."));
5150
#endif/* BOOST_NETWORK_ENABLE_HTTPS*/
5251
}else {
53-
delegate.reset(newnormal_delegate(service));
52+
delegate = std::make_shared<normal_delegate>(service);
5453
}
5554
return delegate;
5655
}
5756
};
5857

5958
}// namespace impl
60-
/* impl*/
61-
}// namespace http
62-
/* http*/
63-
}// namespace network
64-
/* network*/
65-
}// namespace boost
66-
/* boost*/
59+
}// namespace http
60+
}// namespace network
61+
}// namespace boost
6762

6863
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_DELEGATE_FACTORY_HPP_20110819 \
6964
*/

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace network {
2222
namespacehttp {
2323
namespaceimpl {
2424

25-
structssl_delegate : connection_delegate,
26-
std::enable_shared_from_this<ssl_delegate> {
25+
structssl_delegate :publicconnection_delegate,
26+
publicstd::enable_shared_from_this<ssl_delegate> {
2727
ssl_delegate(asio::io_service &service,bool always_verify_peer,
2828
optional<std::string> certificate_filename,
2929
optional<std::string> verify_path,
@@ -32,14 +32,14 @@ struct ssl_delegate : connection_delegate,
3232
optional<std::string> ciphers,long ssl_options);
3333

3434
voidconnect(asio::ip::tcp::endpoint &endpoint, std::string host,
35-
std::uint16_t source_port,
36-
std::function<void(std::error_codeconst &)> handler)override;
37-
voidwrite(asio::streambuf &command_streambuf,
38-
std::function<void(std::error_codeconst &,size_t)> handler)
39-
override;
40-
voidread_some(asio::mutable_buffers_1const &read_buffer,
41-
std::function<void(std::error_codeconst &,size_t)> handler)
42-
override;
35+
std::uint16_t source_port,
36+
std::function<void(std::error_codeconst &)> handler)override;
37+
voidwrite(
38+
asio::streambuf &command_streambuf,
39+
std::function<void(std::error_codeconst &,size_t)> handler)override;
40+
voidread_some(
41+
asio::mutable_buffers_1const &read_buffer,
42+
std::function<void(std::error_codeconst &,size_t)> handler)override;
4343
voiddisconnect()override;
4444
~ssl_delegate()override;
4545

@@ -68,9 +68,4 @@ struct ssl_delegate : connection_delegate,
6868
}// namespace network
6969
}// namespace boost
7070

71-
#ifdef BOOST_NETWORK_NO_LIB
72-
#include<boost/network/protocol/http/client/connection/ssl_delegate.ipp>
73-
#endif/* BOOST_NETWORK_NO_LIB*/
74-
75-
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819 \
76-
*/
71+
#endif// BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp