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

Method IdleAttach

adapter/micro_thread/mt_connection.cpp:399–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

397}
398
399bool TcpKeepConn::IdleAttach()
400{
401 if (_osfd < 0) {
402 MTLOG_ERROR("obj %p attach failed, fd %d error", this, _osfd);
403 return false;
404 }
405
406 if (_keep_flag & TCP_KEEP_IN_KQUEUE) {
407 MTLOG_ERROR("obj %p repeat attach, error", this);
408 return true;
409 }
410
411 _keep_ntfy.DisableOutput();
412 _keep_ntfy.EnableInput();
413
414 CTimerMng* timer = MtFrame::Instance()->GetTimerMng();
415 if ((NULL == timer) || !timer->start_timer(this, _keep_time))
416 {
417 MTLOG_ERROR("obj %p attach timer failed, error", this);
418 return false;
419 }
420
421 if (MtFrame::Instance()->KqueueAddObj(&_keep_ntfy))
422 {
423 _keep_flag |= TCP_KEEP_IN_KQUEUE;
424 return true;
425 }
426 else
427 {
428 MTLOG_ERROR("obj %p attach failed, error", this);
429 return false;
430 }
431}
432
433bool TcpKeepConn::IdleDetach()
434{

Callers 1

CacheTcpKeepConnMethod · 0.80

Calls 5

DisableOutputMethod · 0.80
EnableInputMethod · 0.80
GetTimerMngMethod · 0.80
start_timerMethod · 0.80
KqueueAddObjMethod · 0.80

Tested by

no test coverage detected