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

Method IdleDetach

adapter/micro_thread/mt_connection.cpp:433–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431}
432
433bool TcpKeepConn::IdleDetach()
434{
435 if (_osfd < 0) {
436 MTLOG_ERROR("obj %p detach failed, fd %d error", this, _osfd);
437 return false;
438 }
439
440 if (!(_keep_flag & TCP_KEEP_IN_KQUEUE)) {
441 MTLOG_DEBUG("obj %p repeat detach, error", this);
442 return true;
443 }
444
445 _keep_ntfy.DisableOutput();
446 _keep_ntfy.EnableInput();
447
448 CTimerMng* timer = MtFrame::Instance()->GetTimerMng();
449 if (NULL != timer)
450 {
451 timer->stop_timer(this);
452 }
453
454 if (MtFrame::Instance()->KqueueDelObj(&_keep_ntfy))
455 {
456 _keep_flag &= ~TCP_KEEP_IN_KQUEUE;
457 return true;
458 }
459 else
460 {
461 MTLOG_ERROR("obj %p detach failed, error", this);
462 return false;
463 }
464}
465
466void TcpKeepConn::timer_notify()
467{

Callers 2

GetTcpKeepConnMethod · 0.80
RemoveTcpKeepConnMethod · 0.80

Calls 5

DisableOutputMethod · 0.80
EnableInputMethod · 0.80
GetTimerMngMethod · 0.80
stop_timerMethod · 0.80
KqueueDelObjMethod · 0.80

Tested by

no test coverage detected