| 687 | } |
| 688 | |
| 689 | void Stream::StartIdleTimer() { |
| 690 | if (_options.idle_timeout_ms < 0) { |
| 691 | return; |
| 692 | } |
| 693 | _start_idle_timer_us = butil::gettimeofday_us(); |
| 694 | timespec due_time = butil::microseconds_to_timespec( |
| 695 | _start_idle_timer_us + _options.idle_timeout_ms * 1000); |
| 696 | const int rc = bthread_timer_add(&_idle_timer, due_time, OnIdleTimeout, |
| 697 | (void*)(_consumer_queue.value)); |
| 698 | LOG_IF(WARNING, rc != 0) << "Fail to add timer"; |
| 699 | } |
| 700 | |
| 701 | void Stream::StopIdleTimer() { |
| 702 | if (_options.idle_timeout_ms < 0) { |
no test coverage detected