Browse Source

differentiate UDP server sessions by port

pull/1542/head
orignal 5 years ago
parent
commit
70e4cbc023
  1. 4
      libi2pd_client/I2PTunnel.cpp

4
libi2pd_client/I2PTunnel.cpp

@ -611,7 +611,7 @@ namespace client
void I2PUDPServerTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len) void I2PUDPServerTunnel::HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len)
{ {
if (!m_LastSession || m_LastSession->Identity.GetLL()[0] != from.GetIdentHash ().GetLL()[0]) if (!m_LastSession || m_LastSession->Identity.GetLL()[0] != from.GetIdentHash ().GetLL()[0] || fromPort != m_LastSession->RemotePort)
{ {
std::lock_guard<std::mutex> lock(m_SessionsMutex); std::lock_guard<std::mutex> lock(m_SessionsMutex);
m_LastSession = ObtainUDPSession(from, toPort, fromPort); m_LastSession = ObtainUDPSession(from, toPort, fromPort);
@ -659,7 +659,7 @@ namespace client
auto ih = from.GetIdentHash(); auto ih = from.GetIdentHash();
for (auto & s : m_Sessions ) for (auto & s : m_Sessions )
{ {
if (s->Identity.GetLL()[0] == ih.GetLL()[0]) if (s->Identity.GetLL()[0] == ih.GetLL()[0] && remotePort == s->RemotePort)
{ {
/** found existing session */ /** found existing session */
LogPrint(eLogDebug, "UDPServer: found session ", s->IPSocket.local_endpoint(), " ", ih.ToBase32()); LogPrint(eLogDebug, "UDPServer: found session ", s->IPSocket.local_endpoint(), " ", ih.ToBase32());

Loading…
Cancel
Save