Ejemplo n.º 1
0
void AsyncTimeout::libeventCallback(int fd, short events, void* arg) {
  AsyncTimeout* timeout = reinterpret_cast<AsyncTimeout*>(arg);
  assert(fd == -1);
  assert(events == EV_TIMEOUT);

  // double check that ev_flags gets reset when the timeout is not running
  assert((timeout->event_.ev_flags & ~EVLIST_INTERNAL) == EVLIST_INIT);

  // this can't possibly fire if timeout->eventBase_ is nullptr
  (void) timeout->timeoutManager_->bumpHandlingTime();

  auto old_ctx =
    RequestContext::setContext(timeout->context_);

  timeout->timeoutExpired();

  RequestContext::setContext(old_ctx);
}
Ejemplo n.º 2
0
void AsyncTimeout::libeventCallback(libevent_fd_t fd, short events, void* arg) {
  AsyncTimeout* timeout = reinterpret_cast<AsyncTimeout*>(arg);
  assert(libeventFdToFd(fd) == -1);
  assert(events == EV_TIMEOUT);
  // prevent unused variable warnings
  (void)fd;
  (void)events;

  // double check that ev_flags gets reset when the timeout is not running
  assert((event_ref_flags(&timeout->event_) & ~EVLIST_INTERNAL) == EVLIST_INIT);

  // this can't possibly fire if timeout->eventBase_ is nullptr
  timeout->timeoutManager_->bumpHandlingTime();

  RequestContextScopeGuard rctx(timeout->context_);

  timeout->timeoutExpired();
}