Update for Net-TS Asio (API Change):

fix #769

The following classes are removed:

* handler_type
* async_result
* async_completion
* is_dynamic_buffer
* is_const_buffer_sequence
* is_mutable_buffer_sequence
* handler_alloc

Actions Required:

* Use BOOST_ASIO_HANDLER_TYPE instead of handler_type
* Use BOOST_ASIO_INITFN_RESULT_TYPE instead of async_result
* Use boost::asio::async_completion
* Use boost::asio::is_dynamic_buffer
* Use boost::asio::is_const_buffer_sequence
* Use boost::asio::is_mutable_buffer_sequence
* boost::asio::associated_allocator_t replaces handler_alloc
This commit is contained in:
Vinnie Falco
2017-10-23 17:11:27 -07:00
parent 9dc9ca13b9
commit 3a28e999af
173 changed files with 3214 additions and 4138 deletions
@@ -45,11 +45,11 @@ class session : public std::enable_shared_from_this<session>
std::string text_;
public:
// Resolver and socket require an io_service
// Resolver and socket require an io_context
explicit
session(boost::asio::io_service& ios)
: resolver_(ios)
, ws_(ios)
session(boost::asio::io_context& ioc)
: resolver_(ioc)
, ws_(ioc)
{
}
@@ -65,7 +65,9 @@ public:
text_ = text;
// Look up the domain name
resolver_.async_resolve({host, port},
resolver_.async_resolve(
host,
port,
std::bind(
&session::on_resolve,
shared_from_this(),
@@ -76,7 +78,7 @@ public:
void
on_resolve(
boost::system::error_code ec,
tcp::resolver::iterator result)
tcp::resolver::results_type results)
{
if(ec)
return fail(ec, "resolve");
@@ -84,7 +86,8 @@ public:
// Make the connection on the IP address we get from a lookup
boost::asio::async_connect(
ws_.next_layer(),
result,
results.begin(),
results.end(),
std::bind(
&session::on_connect,
shared_from_this(),
@@ -189,15 +192,15 @@ int main(int argc, char** argv)
auto const port = argv[2];
auto const text = argv[3];
// The io_service is required for all I/O
boost::asio::io_service ios;
// The io_context is required for all I/O
boost::asio::io_context ioc;
// Launch the asynchronous operation
std::make_shared<session>(ios)->run(host, port, text);
std::make_shared<session>(ioc)->run(host, port, text);
// Run the I/O service. The call will return when
// the get operation is complete.
ios.run();
ioc.run();
return EXIT_SUCCESS;
}