MCPcopy Create free account
hub / github.com/caozhiyi/CppNet / _AddEvent

Method _AddEvent

net/linux/CEpoll.cpp:305–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305bool CEpoll::_AddEvent(base::CMemSharePtr<CEventHandler>& event, int32_t event_flag, uint64_t sock) {
306 epoll_event* content = (epoll_event*)event->_data;
307 content->events |= event_flag | EPOLLET;
308 content->data.ptr = (void*)&event->_client_socket;
309
310 int res = epoll_ctl(_epoll_handler, EPOLL_CTL_ADD, sock, content);
311 if (res == -1) {
312 if (errno == EEXIST) {
313 res = _ModifyEvent(event, event_flag, sock);
314 }
315 if (res == -1) {
316 base::LOG_ERROR("add event to epoll faild! error :%d, sock: %d", errno, sock);
317 return false;
318 }
319 }
320 base::LOG_DEBUG("add a event to epoll, event : %d, sock : %d", event->_event_flag_set, sock);
321 return true;
322}
323
324bool CEpoll::_AddEvent(base::CMemSharePtr<CAcceptEventHandler>& event, int32_t event_flag, uint64_t sock) {
325 epoll_event* content = (epoll_event*)event->_data;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected