Added support for new asio api
This commit is contained in:
parent
ded57636dd
commit
5087f5d3df
6 changed files with 142 additions and 79 deletions
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
#ifndef USE_STANDALONE_ASIO
|
||||
namespace asio = boost::asio;
|
||||
#endif
|
||||
|
||||
using HttpServer = SimpleWeb::Server<SimpleWeb::HTTP>;
|
||||
using HttpClient = SimpleWeb::Client<SimpleWeb::HTTP>;
|
||||
|
||||
|
|
@ -315,7 +311,7 @@ int main() {
|
|||
for(auto &thread : threads)
|
||||
thread.join();
|
||||
ASSERT(client.connections.size() == 100);
|
||||
client.io_service->reset();
|
||||
SimpleWeb::restart(*client.io_service);
|
||||
client.io_service->run();
|
||||
ASSERT(client.connections.size() == 1);
|
||||
for(auto call : calls)
|
||||
|
|
@ -390,7 +386,7 @@ int main() {
|
|||
|
||||
// Test Client client's stop()
|
||||
for(size_t c = 0; c < 40; ++c) {
|
||||
auto io_service = make_shared<asio::io_service>();
|
||||
auto io_service = make_shared<SimpleWeb::io_context>();
|
||||
bool call = false;
|
||||
HttpClient client("localhost:8080");
|
||||
client.io_service = io_service;
|
||||
|
|
@ -410,7 +406,7 @@ int main() {
|
|||
|
||||
// Test Client destructor that should cancel the client's request
|
||||
for(size_t c = 0; c < 40; ++c) {
|
||||
auto io_service = make_shared<asio::io_service>();
|
||||
auto io_service = make_shared<SimpleWeb::io_context>();
|
||||
{
|
||||
HttpClient client("localhost:8080");
|
||||
client.io_service = io_service;
|
||||
|
|
@ -431,7 +427,7 @@ int main() {
|
|||
|
||||
// Test server destructor
|
||||
{
|
||||
auto io_service = make_shared<asio::io_service>();
|
||||
auto io_service = make_shared<SimpleWeb::io_context>();
|
||||
bool call = false;
|
||||
bool client_catch = false;
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ int main() {
|
|||
ASSERT(fields_result1 == fields_result2 && fields_result1 == fields);
|
||||
|
||||
auto serverTest = make_shared<ServerTest>();
|
||||
serverTest->io_service = std::make_shared<asio::io_service>();
|
||||
serverTest->io_service = std::make_shared<io_context>();
|
||||
|
||||
serverTest->parse_request_test();
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ int main() {
|
|||
clientTest2->parse_response_header_test();
|
||||
|
||||
|
||||
asio::io_service io_service;
|
||||
io_context io_service;
|
||||
asio::ip::tcp::socket socket(io_service);
|
||||
SimpleWeb::Server<HTTP>::Request request(static_cast<size_t>(-1), nullptr);
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue