| 240 | } |
| 241 | |
| 242 | int main(int argc, char* argv[]) |
| 243 | { |
| 244 | bool use_kernel = false; |
| 245 | int ch; |
| 246 | IO_CTX ctx; |
| 247 | |
| 248 | memset(&ctx, 0, sizeof(ctx)); |
| 249 | ctx.connect_timeout = 5; |
| 250 | ctx.nopen_limit = 10; |
| 251 | ctx.id_begin = 1; |
| 252 | ctx.nwrite_limit = 10; |
| 253 | ctx.debug = false; |
| 254 | snprintf(ctx.addr, sizeof(ctx.addr), "127.0.0.1:9001"); |
| 255 | |
| 256 | while ((ch = getopt(argc, argv, "hc:n:kl:dt:")) > 0) { |
| 257 | switch (ch) { |
| 258 | case 'c': |
| 259 | ctx.nopen_limit = atoi(optarg); |
| 260 | if (ctx.nopen_limit <= 0) |
| 261 | ctx.nopen_limit = 10; |
| 262 | break; |
| 263 | case 'n': |
| 264 | ctx.nwrite_limit = atoi(optarg); |
| 265 | if (ctx.nwrite_limit <= 0) |
| 266 | ctx.nwrite_limit = 10; |
| 267 | break; |
| 268 | case 'h': |
| 269 | usage(argv[0]); |
| 270 | return (0); |
| 271 | case 'k': |
| 272 | use_kernel = true; |
| 273 | break; |
| 274 | case 'l': |
| 275 | snprintf(ctx.addr, sizeof(ctx.addr), "%s", optarg); |
| 276 | break; |
| 277 | case 'd': |
| 278 | ctx.debug = true; |
| 279 | break; |
| 280 | case 't': |
| 281 | ctx.connect_timeout = atoi(optarg); |
| 282 | break; |
| 283 | default: |
| 284 | break; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | acl::meter_time(__FUNCTION__, __LINE__, "-----BEGIN-----"); |
| 289 | acl::acl_cpp_init(); |
| 290 | |
| 291 | acl::aio_handle handle(use_kernel ? acl::ENGINE_KERNEL : acl::ENGINE_SELECT); |
| 292 | ctx.handle = &handle; |
| 293 | |
| 294 | if (connect_server(&ctx, ctx.id_begin) == false) { |
| 295 | std::cout << "enter any key to exit." << std::endl; |
| 296 | getchar(); |
| 297 | return 1; |
| 298 | } |
| 299 |
nothing calls this directly
no test coverage detected
searching dependent graphs…