| 520 | } |
| 521 | |
| 522 | bool 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 | |
| 546 | bool TcpKeepMgr::CacheTcpKeepConn(TcpKeepConn* conn) |
| 547 | { |
no test coverage detected