| 383 | } |
| 384 | |
| 385 | KqueuerObj* 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 | |
| 423 | void NtfyObjMgr::FreeNtfyObj(KqueuerObj* obj) |
| 424 | { |
no test coverage detected