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

Function main

lib_acl_cpp/samples/aio/aio_client/main.cpp:242–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242int 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

Callers

nothing calls this directly

Calls 7

meter_timeFunction · 0.85
acl_cpp_initFunction · 0.85
usageFunction · 0.70
connect_serverFunction · 0.70
getoptFunction · 0.50
checkMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…