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

Method RemoveTcpKeepConn

adapter/micro_thread/mt_connection.cpp:522–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520}
521
522bool TcpKeepMgr::RemoveTcpKeepConn(TcpKeepConn* conn)
523{
524 struct sockaddr_in* dst = conn->GetDestAddr();
525 if ((dst->sin_addr.s_addr == 0) || (dst->sin_port == 0))
526 {
527 MTLOG_ERROR("sock addr, invalid, %x:%d", dst->sin_addr.s_addr, dst->sin_port);
528 return false;
529 }
530
531 TcpKeepKey key(dst);
532 TcpKeepKey* conn_list = (TcpKeepKey*)_keep_hash->HashFindData(&key);
533 if (!conn_list)
534 {
535 MTLOG_ERROR("no conn cache list, invalid, %x:%d", dst->sin_addr.s_addr, dst->sin_port);
536 return false;
537 }
538
539 conn->IdleDetach();
540 conn_list->RemoveConn(conn);
541
542 return true;
543
544}
545
546bool TcpKeepMgr::CacheTcpKeepConn(TcpKeepConn* conn)
547{

Callers 1

CloseIdleTcpKeepMethod · 0.80

Calls 4

HashFindDataMethod · 0.80
IdleDetachMethod · 0.80
RemoveConnMethod · 0.80
GetDestAddrMethod · 0.45

Tested by

no test coverage detected