MCPcopy Create free account
hub / github.com/F-Stack/f-stack / KqueueRcvEventList

Method KqueueRcvEventList

adapter/micro_thread/kqueue_proxy.cpp:366–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366void KqueueProxy::KqueueRcvEventList(int evtfdnum)
367{
368 int ret = 0;
369 int osfd = 0;
370 int revents = 0;
371 int tmp_evts = 0;
372 KqFdRef* item = NULL;
373 KqueuerObj* obj = NULL;
374
375 for (int i = 0; i < evtfdnum; i++)
376 {
377 osfd = _evtlist[i].ident;
378
379 item = KqFdRefGet(osfd);
380 if (item == NULL)
381 {
382 MT_ATTR_API(320851, 1); // fd error
383 MTLOG_ERROR("kqfd ref not find, failed, fd: %d", osfd);
384 kqueue_assert(0);
385 continue;
386 }
387 tmp_evts = _evtlist[i].filter;
388 if (tmp_evts == EVFILT_READ) {
389 revents |= KQ_EVENT_READ;
390 }
391 if (tmp_evts == EVFILT_WRITE) {
392 revents |= KQ_EVENT_WRITE;
393 }
394 obj = item->GetNotifyObj();
395 if (obj == NULL)
396 {
397 MTLOG_ERROR("fd notify obj null, failed, fd: %d", osfd);
398 KqueueCtrlDel(osfd, (revents & (KQ_EVENT_READ | KQ_EVENT_WRITE)));
399 continue;
400 }
401 obj->SetRcvEvents(revents);
402
403 if (tmp_evts == EV_ERROR)
404 {
405 obj->HangupNotify();
406 continue;
407 }
408
409 if (revents & KQ_EVENT_READ)
410 {
411 ret = obj->InputNotify();
412 if (ret != 0)
413 {
414 continue;
415 }
416 }
417
418 if (revents & KQ_EVENT_WRITE)
419 {
420 ret = obj->OutputNotify();
421 if (ret != 0)
422 {
423 continue;

Callers

nothing calls this directly

Calls 5

GetNotifyObjMethod · 0.80
SetRcvEventsMethod · 0.80
HangupNotifyMethod · 0.45
InputNotifyMethod · 0.45
OutputNotifyMethod · 0.45

Tested by

no test coverage detected