MCPcopy Create free account
hub / github.com/chenshuo/muduo / onTimer

Method onTimer

examples/cdns/Resolver.cc:102–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void Resolver::onTimer()
103{
104 assert(timerActive_ == true);
105 ares_process_fd(ctx_, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
106 struct timeval tv;
107 struct timeval* tvp = ares_timeout(ctx_, NULL, &tv);
108 double timeout = getSeconds(tvp);
109 LOG_DEBUG << loop_->pollReturnTime().toString() << " next timeout " << timeout;
110
111 if (timeout < 0)
112 {
113 timerActive_ = false;
114 }
115 else
116 {
117 loop_->runAfter(timeout, std::bind(&Resolver::onTimer, this));
118 }
119}
120
121void Resolver::onQueryResult(int status, struct hostent* result, const Callback& callback)
122{

Callers

nothing calls this directly

Calls 4

pollReturnTimeMethod · 0.80
runAfterMethod · 0.80
getSecondsFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected