Skip to content

Commit 1df7415

Browse files
committed
Address initialization errors.
1 parent b542d50 commit 1df7415

File tree

1 file changed

+7
-1
lines changed
  • boost/network/protocol/http/client

1 file changed

+7
-1
lines changed

boost/network/protocol/http/client/base.ipp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <boost/thread/thread.hpp>
1515
#include <boost/bind.hpp>
1616
#include <boost/network/protocol/http/client/connection_manager.hpp>
17+
#include <boost/network/protocol/http/client/simple_connection_manager.hpp>
1718
#include <boost/network/protocol/http/request.hpp>
1819

1920
namespace boost { namespace network { namespace http {
@@ -65,9 +66,14 @@ client_base::~client_base() {
6566
client_base_pimpl::client_base_pimpl(client_options const &options)
6667
: options_(options),
6768
service_ptr(options.io_service()),
68-
sentinel_(new (std::nothrow) boost::asio::io_service::work(*service_ptr)),
69+
sentinel_(),
6970
connection_manager_(options.connection_manager())
7071
{
72+
if (service_ptr == 0) service_ptr = new(std::nothrow) asio::io_service;
73+
if (!connection_manager_.get())
74+
connection_manager_.reset(
75+
new (std::nothrow) simple_connection_manager(options));
76+
sentinel_.reset(new (std::nothrow) boost::asio::io_service::work(*service_ptr));
7177
lifetime_thread_.reset(new (std::nothrow) boost::thread(
7278
boost::bind(
7379
&boost::asio::io_service::run,

0 commit comments

Comments
 (0)