Browse Source

unbreak (maybe?)

pull/715/head
Jeff Becker 8 years ago
parent
commit
81276cb7f5
  1. 8
      I2PTunnel.cpp
  2. 2
      I2PTunnel.h

8
I2PTunnel.cpp

@ -550,7 +550,7 @@ namespace client
uint64_t now = i2p::util::GetMillisecondsSinceEpoch(); uint64_t now = i2p::util::GetMillisecondsSinceEpoch();
std::vector<uint16_t> removePorts; std::vector<uint16_t> removePorts;
for (const auto & s : m_Sessions) { for (const auto & s : m_Sessions) {
if (now - std::get<1>(s.second) >= delta) if (now - s.second.second >= delta)
removePorts.push_back(s.first); removePorts.push_back(s.first);
} }
for(auto port : removePorts) { for(auto port : removePorts) {
@ -707,7 +707,7 @@ namespace client
// send off to remote i2p destination // send off to remote i2p destination
m_LocalDest->GetDatagramDestination()->SendDatagramTo(m_RecvBuff, transferred, *m_RemoteIdent, remotePort, RemotePort); m_LocalDest->GetDatagramDestination()->SendDatagramTo(m_RecvBuff, transferred, *m_RemoteIdent, remotePort, RemotePort);
// mark convo as active // mark convo as active
std::get<1>(m_Sessions[remotePort]) = i2p::util::GetMillisecondsSinceEpoch(); m_Sessions[remotePort].second = i2p::util::GetMillisecondsSinceEpoch();
} }
std::vector<std::shared_ptr<DatagramSessionInfo> > I2PUDPClientTunnel::GetSessions() std::vector<std::shared_ptr<DatagramSessionInfo> > I2PUDPClientTunnel::GetSessions()
@ -748,9 +748,9 @@ namespace client
LogPrint(eLogDebug, "UDP Client: got ", len, "B from ", from.GetIdentHash().ToBase32()); LogPrint(eLogDebug, "UDP Client: got ", len, "B from ", from.GetIdentHash().ToBase32());
uint8_t sendbuf[len]; uint8_t sendbuf[len];
memcpy(sendbuf, buf, len); memcpy(sendbuf, buf, len);
m_LocalSocket.send_to(boost::asio::buffer(buf, len), std::get<0>(itr->second)); m_LocalSocket.send_to(boost::asio::buffer(buf, len), itr->second.first);
// mark convo as active // mark convo as active
std::get<1>(itr->second) = i2p::util::GetMillisecondsSinceEpoch(); itr->second.second = i2p::util::GetMillisecondsSinceEpoch();
} }
} }
else else

2
I2PTunnel.h

@ -230,7 +230,7 @@ namespace client
void ExpireStale(const uint64_t delta=I2P_UDP_SESSION_TIMEOUT); void ExpireStale(const uint64_t delta=I2P_UDP_SESSION_TIMEOUT);
private: private:
typedef std::tuple<boost::asio::ip::udp::endpoint, uint64_t> UDPConvo; typedef std::pair<boost::asio::ip::udp::endpoint, uint64_t> UDPConvo;
void RecvFromLocal(); void RecvFromLocal();
void HandleRecvFromLocal(const boost::system::error_code & e, std::size_t transferred); void HandleRecvFromLocal(const boost::system::error_code & e, std::size_t transferred);
void HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len); void HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len);

Loading…
Cancel
Save