Esempio n. 1
0
void Channel::HandleEventWithGuard(Timestamp receive_time) {
  event_handling_ = true;
#if defined(__MACH__) || defined(__ANDROID_API__)
  LogTrace("%s", REventsToString().c_str());
#else
  VLOG(1) << REventsToString();
#endif

  if ((revents_ & POLLHUP) && !(revents_ & POLLIN)) {
    if (log_hup_) {
#if defined(__MACH__) || defined(__ANDROID_API__)
      LogWarn("Channel::handle_event() POLLHUP");
#else
      LOG(WARNING) << "Channel::handle_event() POLLHUP";
#endif
    }

    if (close_callback_) {
      close_callback_();
    }
  }

  if (revents_ & POLLNVAL) {
#if defined(__MACH__) || defined(__ANDROID_API__)
    LogWarn("Channel::handle_event() POLLNVAL");
#else
    LOG(WARNING) << "Channel::handle_event() POLLNVAL";
#endif
  }

  if (revents_ & (POLLERR | POLLNVAL)) {
    if (error_callback_) error_callback_();
  }

#ifndef POLLRDHUP
  const int POLLRDHUP = 0;
#endif

  if (revents_ & (POLLIN | POLLPRI | POLLRDHUP)) {
    if (read_callback_) read_callback_(receive_time);
  }

  if (revents_ & POLLOUT) {
    if (write_callback_) write_callback_();
  }

  event_handling_ = false;
}
Esempio n. 2
0
void Connection::Shutdown() {
  close_callback_(shared_from_this());
}
Esempio n. 3
0
void TcpConnection::handle_close() {
    is_connecting_ = false;
    if (close_callback_) {
        close_callback_(shared_from_this());
    }
}