| 784 | } |
| 785 | |
| 786 | void AsyncConnection::tick(uint64_t id) |
| 787 | { |
| 788 | auto now = ceph::coarse_mono_clock::now(); |
| 789 | ldout(async_msgr->cct, 20) << __func__ << " last_id=" << last_tick_id |
| 790 | << " last_active=" << last_active << dendl; |
| 791 | std::lock_guard<std::mutex> l(lock); |
| 792 | last_tick_id = 0; |
| 793 | if (!is_connected()) { |
| 794 | if (connect_timeout_us <= |
| 795 | (uint64_t)std::chrono::duration_cast<std::chrono::microseconds> |
| 796 | (now - last_connect_started).count()) { |
| 797 | ldout(async_msgr->cct, 1) << __func__ << " see no progress in more than " |
| 798 | << connect_timeout_us |
| 799 | << " us during connecting to " |
| 800 | << target_addr << ", fault." |
| 801 | << dendl; |
| 802 | protocol->fault(); |
| 803 | labeled_logger->inc(l_msgr_connection_ready_timeouts); |
| 804 | } else { |
| 805 | last_tick_id = center->create_time_event(connect_timeout_us, tick_handler); |
| 806 | } |
| 807 | } else { |
| 808 | auto idle_period = std::chrono::duration_cast<std::chrono::microseconds> |
| 809 | (now - last_active).count(); |
| 810 | if (inactive_timeout_us < (uint64_t)idle_period) { |
| 811 | ldout(async_msgr->cct, 1) << __func__ << " idle (" << idle_period |
| 812 | << ") for more than " << inactive_timeout_us |
| 813 | << " us, fault." |
| 814 | << dendl; |
| 815 | protocol->fault(); |
| 816 | labeled_logger->inc(l_msgr_connection_idle_timeouts); |
| 817 | } else { |
| 818 | last_tick_id = center->create_time_event(inactive_timeout_us, tick_handler); |
| 819 | } |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | void AsyncConnection::dump(Formatter *f, bool tcp_info) { |
| 824 | std::lock_guard<std::mutex> l(lock); |
no test coverage detected