Browse Source

correct message type for ShortTunnelBuild

pull/1677/head
orignal 3 years ago
parent
commit
bdc1107c96
  1. 4
      libi2pd/Tunnel.cpp
  2. 11
      libi2pd/TunnelConfig.h

4
libi2pd/Tunnel.cpp

@ -88,7 +88,7 @@ namespace tunnel @@ -88,7 +88,7 @@ namespace tunnel
}
hop = hop->prev;
}
msg->FillI2NPMessageHeader (eI2NPVariableTunnelBuild);
msg->FillI2NPMessageHeader (m_Config->IsShort () ? eI2NPShortTunnelBuild : eI2NPVariableTunnelBuild);
// send message
if (outboundTunnel)
@ -99,7 +99,7 @@ namespace tunnel @@ -99,7 +99,7 @@ namespace tunnel
if (ident)
{
auto msg1 = i2p::garlic::WrapECIESX25519MessageForRouter (msg, ident->GetEncryptionPublicKey ());
if (msg1) msg = msg;
if (msg1) msg = msg1;
}
}
outboundTunnel->SendTunnelDataMsg (GetNextIdentHash (), 0, msg);

11
libi2pd/TunnelConfig.h

@ -91,14 +91,17 @@ namespace tunnel @@ -91,14 +91,17 @@ namespace tunnel
{
public:
TunnelConfig (const std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers) // inbound
TunnelConfig (const std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers,
bool isShort = false): // inbound
m_IsShort (isShort)
{
CreatePeers (peers);
m_LastHop->SetNextIdent (i2p::context.GetIdentHash ());
}
TunnelConfig (const std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers,
uint32_t replyTunnelID, const i2p::data::IdentHash& replyIdent) // outbound
uint32_t replyTunnelID, const i2p::data::IdentHash& replyIdent, bool isShort = false): // outbound
m_IsShort (isShort)
{
CreatePeers (peers);
m_FirstHop->isGateway = false;
@ -185,7 +188,7 @@ namespace tunnel @@ -185,7 +188,7 @@ namespace tunnel
protected:
// this constructor can't be called from outside
TunnelConfig (): m_FirstHop (nullptr), m_LastHop (nullptr)
TunnelConfig (): m_FirstHop (nullptr), m_LastHop (nullptr), m_IsShort (false)
{
}
@ -218,7 +221,7 @@ namespace tunnel @@ -218,7 +221,7 @@ namespace tunnel
private:
TunnelHopConfig * m_FirstHop, * m_LastHop;
bool m_IsShort = false;
bool m_IsShort;
};
class ZeroHopsTunnelConfig: public TunnelConfig

Loading…
Cancel
Save