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

Method HashCmp

adapter/micro_thread/mt_net.cpp:598–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598int32_t CNetHandler::HashCmp(HashKey* rhs)
599{
600 CNetHandler* data = (CNetHandler*)(rhs);
601 if (!data) {
602 return -1;
603 }
604 if (this->_session_id != data->_session_id)
605 {
606 return (this->_session_id > data->_session_id) ? 1 : -1;
607 }
608
609 if (this->_dest_ipv4.sin_addr.s_addr != data->_dest_ipv4.sin_addr.s_addr) {
610 return (this->_dest_ipv4.sin_addr.s_addr > data->_dest_ipv4.sin_addr.s_addr) ? 1 : -1;
611 }
612 if (this->_dest_ipv4.sin_port != data->_dest_ipv4.sin_port) {
613 return (this->_dest_ipv4.sin_port > data->_dest_ipv4.sin_port) ? 1 : -1;
614 }
615 if (this->_proto_type != data->_proto_type) {
616 return (this->_proto_type > data->_proto_type) ? 1 : -1;
617 }
618 if (this->_conn_type != data->_conn_type) {
619 return (this->_conn_type > data->_conn_type) ? 1 : -1;
620 }
621
622 return 0;
623};
624
625bool CNetHandler::RegistSession()
626{

Callers 2

HashFindMethod · 0.45
HashRemoveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected