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

Method GetNtfyObj

adapter/micro_thread/mt_notify.cpp:385–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385KqueuerObj* NtfyObjMgr::GetNtfyObj(int type, int session_name)
386{
387 KqueuerObj* obj = NULL;
388 SessionProxy* proxy = NULL;
389
390 switch (type)
391 {
392 case NTFY_OBJ_THREAD:
393 obj = _fd_ntfy_pool.AllocPtr();
394 break;
395
396 case NTFY_OBJ_SESSION:
397 proxy = _udp_proxy_pool.AllocPtr();
398 obj = proxy;
399 break;
400
401 case NTFY_OBJ_KEEPALIVE: // no need get this now
402 break;
403
404 default:
405 break;
406 }
407
408 if (proxy) {
409 ISessionNtfy* ntfy = this->GetNameSession(session_name);
410 if (!ntfy) {
411 MTLOG_ERROR("ntfy get session name(%d) failed", session_name);
412 this->FreeNtfyObj(proxy);
413 obj = NULL;
414 } else {
415 proxy->SetRealNtfyObj(ntfy);
416 }
417 }
418
419 return obj;
420
421}
422
423void NtfyObjMgr::FreeNtfyObj(KqueuerObj* obj)
424{

Callers 3

InputNotifyMethod · 0.45
mt_multi_netfd_pollMethod · 0.45
mt_tcp_get_keep_connFunction · 0.45

Calls 4

GetNameSessionMethod · 0.95
FreeNtfyObjMethod · 0.95
AllocPtrMethod · 0.80
SetRealNtfyObjMethod · 0.80

Tested by

no test coverage detected