Modify the webapp_test

This commit is contained in:
antao 2019-01-19 14:13:31 +08:00
parent 8c6c549b9d
commit 8f7adc4ae7
1 changed files with 9 additions and 3 deletions

View File

@ -15,6 +15,7 @@
//Make a http client to test the example server app; //Make a http client to test the example server app;
#include <drogon/drogon.h> #include <drogon/drogon.h>
#include <trantor/net/EventLoopThread.h>
#include <mutex> #include <mutex>
#define RESET "\033[0m" #define RESET "\033[0m"
#define RED "\033[31m" /* Red */ #define RED "\033[31m" /* Red */
@ -413,11 +414,16 @@ void doTest(const HttpClientPtr &client)
} }
int main() int main()
{ {
auto client = HttpClient::newHttpClient("http://127.0.0.1:8848"); trantor::EventLoopThread loop[2];
loop[0].run();
loop[1].run();
auto client = HttpClient::newHttpClient("http://127.0.0.1:8848",loop[0].getLoop());
doTest(client); doTest(client);
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
auto sslClient = HttpClient::newHttpClient("https://127.0.0.1:8849"); auto sslClient = HttpClient::newHttpClient("https://127.0.0.1:8849",loop[1].getLoop());
doTest(sslClient); doTest(sslClient);
#endif #endif
app().run(); getchar();
loop[0].getLoop()->quit();
loop[1].getLoop()->quit();
} }