| 374 | #if !defined(_WIN32) && !defined(_WIN64) |
| 375 | |
| 376 | static void main_fiber_monitor_master(ACL_FIBER *fiber, void *ctx) |
| 377 | { |
| 378 | ACL_VSTREAM *stat_stream = (ACL_VSTREAM *) ctx; |
| 379 | char buf[8192]; |
| 380 | int ret, n = 0; |
| 381 | |
| 382 | stat_stream->rw_timeout = -1; |
| 383 | ret = acl_vstream_read(stat_stream, buf, sizeof(buf)); |
| 384 | acl_msg_info("%s(%d), %s: disconnect(%d) from acl_master, clients %lld", |
| 385 | __FILE__, __LINE__, __FUNCTION__, ret, |
| 386 | acl_atomic_clock_users(__clock)); |
| 387 | |
| 388 | /* must close listening as quickly as possible, so that acl_master |
| 389 | * can rebind the addr quickly. |
| 390 | */ |
| 391 | acl_msg_info("%s(%d), %s: stopping listen ...", |
| 392 | __FILE__, __LINE__, __FUNCTION__); |
| 393 | main_stop_listen(); |
| 394 | acl_msg_info("%s(%d), %s: stop listen ok", |
| 395 | __FILE__, __LINE__, __FUNCTION__); |
| 396 | |
| 397 | /* the user's callback will be called here */ |
| 398 | if (__service_preexit) { |
| 399 | while (true) { |
| 400 | acl_msg_info("%s(%d), %s: calling server_pre_exit ...", |
| 401 | __FILE__, __LINE__, __FUNCTION__); |
| 402 | |
| 403 | if (__service_preexit(__service_ctx)) { |
| 404 | break; |
| 405 | } |
| 406 | |
| 407 | acl_fiber_sleep(1); |
| 408 | } |
| 409 | |
| 410 | acl_msg_info("%s(%d), %s: server_pre_exit ok", |
| 411 | __FILE__, __LINE__, __FUNCTION__); |
| 412 | } |
| 413 | |
| 414 | while (!acl_var_fiber_quick_abort) { |
| 415 | if (acl_atomic_clock_users(__clock) <= 0) { |
| 416 | acl_msg_warn("%s(%d), %s: all clients closed!", |
| 417 | __FILE__, __LINE__, __FUNCTION__); |
| 418 | break; |
| 419 | } |
| 420 | |
| 421 | acl_fiber_sleep(1); |
| 422 | n++; |
| 423 | |
| 424 | if (acl_var_fiber_wait_limit > 0 |
| 425 | && n >= acl_var_fiber_wait_limit) { |
| 426 | |
| 427 | acl_msg_warn("%s(%d), %s: too long, clients: %lld", |
| 428 | __FILE__, __LINE__, __FUNCTION__, |
| 429 | acl_atomic_clock_users(__clock)); |
| 430 | break; |
| 431 | } |
| 432 | |
| 433 | acl_msg_info("%s(%d), %s: waiting %d, clients %lld", |
nothing calls this directly
no test coverage detected
searching dependent graphs…