Beispiel #1
0
void Channel::handleEvents() {
	LOG_INFO << "handle event "
	         << sockfd_
	         << " events "
	         << EventToString(r_events_);

	if ( (r_events_ & EPOLLRDHUP ) && (r_events_ & EPOLLIN) ) {
		LOG_INFO << "handle close" ;
		if (closeCallBack_) {
			closeCallBack_();
			return;
		}
	}

	if ( r_events_ & EPOLLIN  ) {
		LOG_INFO << "handle read" ;
		if (readCallBack_) {
			readCallBack_();
			return;
		}
	}

	if (r_events_ & EPOLLOUT ) {
		LOG_INFO << "handle write" ;
		if (writeCallBack_) writeCallBack_();
	}

	if (r_events_ & EPOLLERR) {
		LOG_INFO << "handle error" ;
		if (errorCallBack_) errorCallBack_();
	}
};
Beispiel #2
0
	void Channel::HandleEvent()
	{
		if (readyEvent_ == EventType::kReadEvent)
		{
			readCallBack_();
		}

		if (readyEvent_ == EventType::kWriteEvent)
		{
			writeCallBack_();
		}
	}