Skip to content

Link with standard libraries instead of Boost #591

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 9 commits into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Replaced boost asio with standalone (and header only) asio (v 1.11.0).
  • Loading branch information
glynos committed Jan 31, 2016
commit 8a0381e70b40a542f959ef4b8aaccd1174ee830c
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "deps/cxxopts"]
path = deps/cxxopts
url = https://github.com/jarro2783/cxxopts.git
[submodule "deps/asio"]
path = deps/asio
url = https://github.com/chriskohlhoff/asio.git
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ if (Boost_FOUND)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
include_directories(${Boost_INCLUDE_DIRS})

# Asio
add_definitions(-DASIO_HEADER_ONLY)
include_directories(deps/asio/asio/include)

enable_testing()
add_subdirectory(libs/network/src)
if (CPP-NETLIB_BUILD_TESTS)
Expand Down
1 change: 0 additions & 1 deletion boost/network/protocol/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/traits/ostringstream.hpp>

#include <boost/asio/io_service.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <istream>
Expand Down
20 changes: 10 additions & 10 deletions boost/network/protocol/http/client/async_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include <thread>
#include <memory>
#include <functional>
#include <boost/asio/io_service.hpp>
#include <boost/asio/strand.hpp>
#include <asio/io_service.hpp>
#include <asio/strand.hpp>
#include <boost/network/protocol/http/traits/connection_policy.hpp>

namespace boost {
Expand All @@ -32,13 +32,13 @@ struct async_client
typedef typename string<Tag>::type string_type;

typedef std::function<void(boost::iterator_range<char const*> const&,
system::error_code const&)> body_callback_function_type;
std::error_code const&)> body_callback_function_type;

typedef std::function<bool(string_type&)> body_generator_function_type;

async_client(bool cache_resolved, bool follow_redirect,
bool always_verify_peer, int timeout,
std::shared_ptr<boost::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 @@ -47,10 +47,10 @@ struct async_client
: connection_base(cache_resolved, follow_redirect, timeout),
service_ptr(service.get()
? service
: std::make_shared<boost::asio::io_service>()),
: std::make_shared<asio::io_service>()),
service_(*service_ptr),
resolver_(service_),
sentinel_(new boost::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 @@ -59,7 +59,7 @@ struct async_client
ssl_options_(ssl_options),
always_verify_peer_(always_verify_peer) {
connection_base::resolver_strand_.reset(
new boost::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 @@ -87,10 +87,10 @@ struct async_client
generator);
}

std::shared_ptr<boost::asio::io_service> service_ptr;
boost::asio::io_service& service_;
std::shared_ptr<asio::io_service> service_ptr;
asio::io_service& service_;
resolver_type resolver_;
std::shared_ptr<boost::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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct async_connection_base {
typedef basic_request<Tag> request;
typedef basic_response<Tag> response;
typedef iterator_range<char const *> char_const_range;
typedef std::function<void(char_const_range const &, system::error_code const &)>
typedef std::function<void(char_const_range const &, std::error_code const &)>
body_callback_function_type;
typedef std::function<bool(string_type &)> body_generator_function_type;
typedef std::shared_ptr<this_type> connection_ptr;
Expand Down
Loading