| 206 | } |
| 207 | |
| 208 | int main(int argc, char* argv[]) |
| 209 | { |
| 210 | bool use_kernel = false; |
| 211 | int ch; |
| 212 | IO_CTX ctx; |
| 213 | |
| 214 | memset(&ctx, 0, sizeof(ctx)); |
| 215 | ctx.connect_timeout = 500; |
| 216 | ctx.nopen_limit = 10; |
| 217 | ctx.id_begin = 1; |
| 218 | ctx.nwrite_limit = 10; |
| 219 | ctx.debug = false; |
| 220 | //snprintf(ctx.addr, sizeof(ctx.addr), "74.125.71.19:443"); |
| 221 | //snprintf(ctx.addr, sizeof(ctx.addr), "www.google.com.hk:443"); |
| 222 | snprintf(ctx.addr, sizeof(ctx.addr), "mail.sina.com.cn:443"); |
| 223 | |
| 224 | while ((ch = getopt(argc, argv, "hc:n:kl:dt:")) > 0) |
| 225 | { |
| 226 | switch (ch) |
| 227 | { |
| 228 | case 'c': |
| 229 | ctx.nopen_limit = atoi(optarg); |
| 230 | if (ctx.nopen_limit <= 0) |
| 231 | ctx.nopen_limit = 10; |
| 232 | break; |
| 233 | case 'n': |
| 234 | ctx.nwrite_limit = atoi(optarg); |
| 235 | if (ctx.nwrite_limit <= 0) |
| 236 | ctx.nwrite_limit = 10; |
| 237 | break; |
| 238 | case 'h': |
| 239 | usage(argv[0]); |
| 240 | return (0); |
| 241 | case 'k': |
| 242 | use_kernel = true; |
| 243 | break; |
| 244 | case 'l': |
| 245 | snprintf(ctx.addr, sizeof(ctx.addr), "%s", optarg); |
| 246 | break; |
| 247 | case 'd': |
| 248 | ctx.debug = true; |
| 249 | break; |
| 250 | case 't': |
| 251 | ctx.connect_timeout = atoi(optarg); |
| 252 | break; |
| 253 | default: |
| 254 | break; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | ACL_METER_TIME("-----BEGIN-----"); |
| 259 | acl::acl_cpp_init(); |
| 260 | |
| 261 | aio_handle handle(use_kernel ? ENGINE_KERNEL : ENGINE_SELECT); |
| 262 | ctx.handle = &handle; |
| 263 | |
| 264 | if (connect_ssl_server(&ctx, ctx.id_begin) == false) |
| 265 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…