diff --git a/G2ProtocolHandler.cpp b/G2ProtocolHandler.cpp index d6cfd86..2e3aca2 100644 --- a/G2ProtocolHandler.cpp +++ b/G2ProtocolHandler.cpp @@ -41,7 +41,7 @@ m_port(0U) CG2ProtocolHandler::~CG2ProtocolHandler() { delete[] m_buffer; - m_portmap.clear(); + // m_portmap.clear(); } bool CG2ProtocolHandler::open() @@ -59,11 +59,11 @@ bool CG2ProtocolHandler::writeHeader(const CHeaderData& header) #endif in_addr addr = header.getYourAddress(); - auto found = m_portmap.find(addr.s_addr); - unsigned int port = (m_portmap.end()==found) ? header.getYourPort() : found->second; + // auto found = m_portmap.find(addr.s_addr); + // unsigned int port = (m_portmap.end()==found) ? header.getYourPort() : found->second; for (unsigned int i = 0U; i < 5U; i++) { - bool res = m_socket.write(buffer, length, addr, port); + bool res = m_socket.write(buffer, length, addr, m_port); if (!res) return false; } @@ -81,10 +81,10 @@ bool CG2ProtocolHandler::writeAMBE(const CAMBEData& data) #endif in_addr addr = data.getYourAddress(); - auto found = m_portmap.find(addr.s_addr); - unsigned int port = (m_portmap.end()==found) ? data.getYourPort() : found->second; + // auto found = m_portmap.find(addr.s_addr); + // unsigned int port = (m_portmap.end()==found) ? data.getYourPort() : found->second; - return m_socket.write(buffer, length, addr, port); + return m_socket.write(buffer, length, addr, m_port); } G2_TYPE CG2ProtocolHandler::read() @@ -110,15 +110,15 @@ bool CG2ProtocolHandler::readPackets() m_length = length; // save the incoming port (this is to enable mobile hotspots) - if (m_portmap.end() == m_portmap.find(m_address.s_addr)) { - CLog::logInfo("new address %s on port %u\n", inet_ntoa(m_address), m_port); - m_portmap[m_address.s_addr] = m_port; - } else { - if (m_portmap[m_address.s_addr] != m_port) { - CLog::logInfo("new port for %s is %u, was %u\n", inet_ntoa(m_address), m_port, m_portmap[m_address.s_addr]); - m_portmap[m_address.s_addr] = m_port; - } - } + // if (m_portmap.end() == m_portmap.find(m_address.s_addr)) { + // CLog::logInfo("new address %s on port %u\n", inet_ntoa(m_address), m_port); + // m_portmap[m_address.s_addr] = m_port; + // } else { + // if (m_portmap[m_address.s_addr] != m_port) { + // CLog::logInfo("new port for %s is %u, was %u\n", inet_ntoa(m_address), m_port, m_portmap[m_address.s_addr]); + // m_portmap[m_address.s_addr] = m_port; + // } + // } if (m_buffer[0] != 'D' || m_buffer[1] != 'S' || m_buffer[2] != 'V' || m_buffer[3] != 'T') { return true; diff --git a/G2ProtocolHandler.h b/G2ProtocolHandler.h index 14eb0b3..82c58f1 100644 --- a/G2ProtocolHandler.h +++ b/G2ProtocolHandler.h @@ -50,7 +50,7 @@ public: void traverseNat(const std::string& address); private: - std::unordered_map m_portmap; + // std::unordered_map m_portmap; CUDPReaderWriter m_socket; G2_TYPE m_type;