MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/ssl/https_request_static/main.cpp:15–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13}
14
15int 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());

Callers

nothing calls this directly

Calls 12

acl_cpp_initFunction · 0.85
beginMethod · 0.80
thread_idMethod · 0.80
usageFunction · 0.70
getoptFunction · 0.50
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
emptyMethod · 0.45
push_backMethod · 0.45
startMethod · 0.45
endMethod · 0.45
waitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…