| 13 | } |
| 14 | |
| 15 | int main(int argc, char* argv[]) |
| 16 | { |
| 17 | int ch, cocurrent = 1, count = 10; |
| 18 | acl::string server_addr("127.0.0.1:1443"), host; |
| 19 | acl::string url("/"); |
| 20 | |
| 21 | acl::acl_cpp_init(); |
| 22 | acl::log::stdout_open(true); |
| 23 | |
| 24 | while ((ch = getopt(argc, argv, "hs:c:n:H:U:")) > 0) { |
| 25 | switch (ch) { |
| 26 | case 'h': |
| 27 | usage(argv[0]); |
| 28 | return 0; |
| 29 | case 'c': |
| 30 | cocurrent = atoi(optarg); |
| 31 | break; |
| 32 | case 'n': |
| 33 | count = atoi(optarg); |
| 34 | break; |
| 35 | case 's': |
| 36 | server_addr = optarg; |
| 37 | break; |
| 38 | case 'H': |
| 39 | host = optarg; |
| 40 | break; |
| 41 | case 'U': |
| 42 | url = optarg; |
| 43 | break; |
| 44 | default: |
| 45 | break; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | acl::sslbase_conf* ssl_conf = new acl::mbedtls_conf(false); |
| 50 | |
| 51 | if (host.empty()) { |
| 52 | host = server_addr; |
| 53 | } |
| 54 | |
| 55 | struct timeval begin; |
| 56 | gettimeofday(&begin, NULL); |
| 57 | |
| 58 | std::list<https_request*> threads; |
| 59 | |
| 60 | for (int i = 0; i < cocurrent; i++) { |
| 61 | https_request* thread = new https_request( |
| 62 | ssl_conf, server_addr, host, url); |
| 63 | |
| 64 | thread->set_detachable(false); |
| 65 | threads.push_back(thread); |
| 66 | thread->start(); |
| 67 | } |
| 68 | |
| 69 | std::list<https_request*>::iterator it = threads.begin(); |
| 70 | for (; it != threads.end(); ++it) { |
| 71 | if ((*it)->wait(NULL)) { |
| 72 | printf("wait thread(%lu) ok\r\n", (*it)->thread_id()); |
nothing calls this directly
no test coverage detected
searching dependent graphs…