MCPcopy Create free account
hub / github.com/apache/brpc / StartIdleTimer

Method StartIdleTimer

src/brpc/stream.cpp:689–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

687}
688
689void 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
701void Stream::StopIdleTimer() {
702 if (_options.idle_timeout_ms < 0) {

Callers 1

ConsumeMethod · 0.80

Calls 3

microseconds_to_timespecFunction · 0.85
bthread_timer_addFunction · 0.85
gettimeofday_usFunction · 0.50

Tested by

no test coverage detected