Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Fix I2NP header default expiration time.
Browse files Browse the repository at this point in the history
* Correct NTCP/SSU priority costs
* Style refactor
  - If function args newline break,
    ensure that *every* indent is 4 spaces and not 2.
  - enumerations: e -> e_
  • Loading branch information
anonimal committed Jan 14, 2016
1 parent ad065b6 commit 6df2efd
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 123 deletions.
2 changes: 1 addition & 1 deletion src/api/Datagram.cpp
Expand Up @@ -192,7 +192,7 @@ I2NPMessage* DatagramDestination::CreateDataMessage(
htobe16buf(buf + 6, toPort); // destination port
buf[9] = i2p::client::PROTOCOL_TYPE_DATAGRAM; // datagram protocol
msg->len += size + 4;
msg->FillI2NPMessageHeader(eI2NPData);
msg->FillI2NPMessageHeader(e_I2NPData);
return msg;
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/Streaming.cpp
Expand Up @@ -838,7 +838,7 @@ std::shared_ptr<I2NPMessage> Stream::CreateDataMessage(
// streaming protocol
buf[9] = i2p::client::PROTOCOL_TYPE_STREAMING;
msg->len += size + 4;
msg->FillI2NPMessageHeader(eI2NPData);
msg->FillI2NPMessageHeader(e_I2NPData);
return msg;
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/Streaming.h
Expand Up @@ -346,8 +346,8 @@ class StreamingDestination {
StreamingDestination(
i2p::client::ClientDestination& owner,
uint16_t localPort = 0)
: m_Owner(owner),
m_LocalPort(localPort) {}
: m_Owner(owner),
m_LocalPort(localPort) {}
~StreamingDestination() {}

void Start();
Expand Down
26 changes: 13 additions & 13 deletions src/client/Destination.cpp
Expand Up @@ -66,10 +66,10 @@ ClientDestination::ClientDestination(
i2p::context.GetRandomNumberGenerator(),
m_EncryptionPrivateKey,
m_EncryptionPublicKey);
int inboundTunnelLen = DEFAULT_INBOUND_TUNNEL_LENGTH;
int outboundTunnelLen = DEFAULT_OUTBOUND_TUNNEL_LENGTH;
int inboundTunnelsQuantity = DEFAULT_INBOUND_TUNNELS_QUANTITY;
int outboundTunnelsQuantity = DEFAULT_OUTBOUND_TUNNELS_QUANTITY;
int inboundTunnelLen = DEFAULT_INBOUND_TUNNEL_LENGTH,
outboundTunnelLen = DEFAULT_OUTBOUND_TUNNEL_LENGTH,
inboundTunnelsQuantity = DEFAULT_INBOUND_TUNNELS_QUANTITY,
outboundTunnelsQuantity = DEFAULT_OUTBOUND_TUNNELS_QUANTITY;
std::shared_ptr<std::vector<i2p::data::IdentHash> > explicitPeers;
if (params) {
auto it = params->find(I2CP_PARAM_INBOUND_TUNNEL_LENGTH);
Expand Down Expand Up @@ -119,11 +119,11 @@ ClientDestination::ClientDestination(
}
m_Pool =
i2p::tunnel::tunnels.CreateTunnelPool(
this,
inboundTunnelLen,
outboundTunnelLen,
inboundTunnelsQuantity,
outboundTunnelsQuantity);
this,
inboundTunnelLen,
outboundTunnelLen,
inboundTunnelsQuantity,
outboundTunnelsQuantity);
if (explicitPeers)
m_Pool->SetExplicitPeers(explicitPeers);
if (m_IsPublic)
Expand Down Expand Up @@ -275,27 +275,27 @@ void ClientDestination::HandleI2NPMessage(
std::shared_ptr<i2p::tunnel::InboundTunnel> from) {
uint8_t typeID = buf[I2NP_HEADER_TYPEID_OFFSET];
switch (typeID) {
case eI2NPData:
case e_I2NPData:
HandleDataMessage(
buf + I2NP_HEADER_SIZE,
bufbe16toh(
buf + I2NP_HEADER_SIZE_OFFSET));
break;
case eI2NPDeliveryStatus:
case e_I2NPDeliveryStatus:
// we assume tunnel tests non-encrypted
HandleDeliveryStatusMessage(
CreateI2NPMessage(
buf,
GetI2NPMessageLength(buf),
from));
break;
case eI2NPDatabaseStore:
case e_I2NPDatabaseStore:
HandleDatabaseStoreMessage(
buf + I2NP_HEADER_SIZE,
bufbe16toh(
buf + I2NP_HEADER_SIZE_OFFSET));
break;
case eI2NPDatabaseSearchReply:
case e_I2NPDatabaseSearchReply:
HandleDatabaseSearchReplyMessage(
buf + I2NP_HEADER_SIZE,
bufbe16toh(
Expand Down
3 changes: 2 additions & 1 deletion src/client/Destination.h
Expand Up @@ -174,7 +174,8 @@ class ClientDestination : public i2p::garlic::GarlicDestination {
std::shared_ptr<const i2p::data::LeaseSet> GetLeaseSet();

std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool() const {
return m_Pool; }
return m_Pool;
}

void HandleI2NPMessage(
const uint8_t* buf,
Expand Down
2 changes: 1 addition & 1 deletion src/core/Garlic.cpp
Expand Up @@ -191,7 +191,7 @@ std::shared_ptr<I2NPMessage> GarlicRoutingSession::WrapSingleMessage(
len += CreateAESBlock(buf, msg);
htobe32buf(m->GetPayload(), len);
m->len += len + 4;
m->FillI2NPMessageHeader(eI2NPGarlic);
m->FillI2NPMessageHeader(e_I2NPGarlic);
return m;
}

Expand Down

0 comments on commit 6df2efd

Please sign in to comment.