Skip to content

Commit

Permalink
fix mixing tabs and spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfl committed Jan 13, 2018
1 parent 46f62e1 commit 50ba527
Show file tree
Hide file tree
Showing 32 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion daemon/HTTPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace http
private:

void Run ();
void Accept ();
void Accept ();
void HandleAccept(const boost::system::error_code& ecode,
std::shared_ptr<boost::asio::ip::tcp::socket> newSocket);
void CreateConnection(std::shared_ptr<boost::asio::ip::tcp::socket> newSocket);
Expand Down
4 changes: 2 additions & 2 deletions daemon/I2PControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ namespace client
void I2PControlService::Handshake (std::shared_ptr<ssl_socket> socket)
{
socket->async_handshake(boost::asio::ssl::stream_base::server,
std::bind( &I2PControlService::HandleHandshake, this, std::placeholders::_1, socket));
std::bind( &I2PControlService::HandleHandshake, this, std::placeholders::_1, socket));
}

void I2PControlService::HandleHandshake (const boost::system::error_code& ecode, std::shared_ptr<ssl_socket> socket)
Expand All @@ -187,7 +187,7 @@ namespace client
}

void I2PControlService::HandleRequestReceived (const boost::system::error_code& ecode,
size_t bytes_transferred, std::shared_ptr<ssl_socket> socket,
size_t bytes_transferred, std::shared_ptr<ssl_socket> socket,
std::shared_ptr<I2PControlBuffer> buf)
{
if (ecode)
Expand Down
6 changes: 3 additions & 3 deletions libi2pd/Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ namespace data
if (pos < len)
{
tmp <<= 8;
tmp |= inBuf[pos] & 0xFF;
tmp |= inBuf[pos] & 0xFF;
pos++;
bits += 8;
bits += 8;
}
else // last byte
{
tmp <<= (5 - bits);
bits = 5;
bits = 5;
}
}

Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace crypto
0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD,
0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37,
0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6,
0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED,
0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED,
0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6,
0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05,
0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F,
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Datagram.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace datagram
DatagramDestination (std::shared_ptr<i2p::client::ClientDestination> owner);
~DatagramDestination ();

void SendDatagramTo (const uint8_t * payload, size_t len, const i2p::data::IdentHash & ident, uint16_t fromPort = 0, uint16_t toPort = 0);
void SendDatagramTo (const uint8_t * payload, size_t len, const i2p::data::IdentHash & ident, uint16_t fromPort = 0, uint16_t toPort = 0);
void HandleDataMessagePayload (uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len);

void SetReceiver (const Receiver& receiver) { m_Receiver = receiver; };
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ namespace client
delete m_DatagramDestination;
m_DatagramDestination = nullptr;
}
return true;
return true;
}
else
return false;
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Destination.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ namespace client
int m_StreamingAckDelay;
std::shared_ptr<i2p::stream::StreamingDestination> m_StreamingDestination; // default
std::map<uint16_t, std::shared_ptr<i2p::stream::StreamingDestination> > m_StreamingDestinationsByPorts;
i2p::datagram::DatagramDestination * m_DatagramDestination;
i2p::datagram::DatagramDestination * m_DatagramDestination;
int m_RefCounter; // how many clients(tunnels) use this destination

boost::asio::deadline_timer m_ReadyChecker;
Expand Down
4 changes: 2 additions & 2 deletions libi2pd/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace fs {
boost::filesystem::create_directory(destinations);
std::string tags = DataDirPath("tags");
if (!boost::filesystem::exists(tags))
boost::filesystem::create_directory(tags);
boost::filesystem::create_directory(tags);
else
i2p::garlic::CleanUpTagsFiles ();

Expand Down Expand Up @@ -136,7 +136,7 @@ namespace fs {
return boost::filesystem::remove(path);
}

bool CreateDirectory (const std::string& path)
bool CreateDirectory (const std::string& path)
{
if (boost::filesystem::exists(path) &&
boost::filesystem::is_directory (boost::filesystem::status (path))) return true;
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Garlic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace garlic
m_LeaseSetUpdateMsgID = 0;
}
return !m_SessionTags.empty () || !m_UnconfirmedTagsMsgs.empty ();
}
}

bool GarlicRoutingSession::CleanupUnconfirmedTags ()
{
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/HTTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ namespace http {
{
o << method << " " << uri << " " << version << CRLF;
for (auto & h : headers)
o << h.first << ": " << h.second << CRLF;
o << h.first << ": " << h.second << CRLF;
o << CRLF;
}

Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Identity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ namespace data
void PrivateKeys::Sign (const uint8_t * buf, int len, uint8_t * signature) const
{
if (!m_Signer)
CreateSigner();
CreateSigner();
m_Signer->Sign (buf, len, signature);
}

Expand Down
8 changes: 4 additions & 4 deletions libi2pd/Identity.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ namespace data
size_t ToBuffer (uint8_t * buf, size_t len) const;
size_t FromBase64(const std::string& s);
std::string ToBase64 () const;
const Identity& GetStandardIdentity () const { return m_StandardIdentity; };
const Identity& GetStandardIdentity () const { return m_StandardIdentity; };

const IdentHash& GetIdentHash () const { return m_IdentHash; };
const uint8_t * GetEncryptionPublicKey () const { return m_StandardIdentity.publicKey; };
uint8_t * GetEncryptionPublicKeyBuffer () { return m_StandardIdentity.publicKey; };
const uint8_t * GetEncryptionPublicKey () const { return m_StandardIdentity.publicKey; };
uint8_t * GetEncryptionPublicKeyBuffer () { return m_StandardIdentity.publicKey; };
std::shared_ptr<i2p::crypto::CryptoKeyEncryptor> CreateEncryptor (const uint8_t * key) const;
size_t GetFullLen () const { return m_ExtendedLen + DEFAULT_IDENTITY_SIZE; };
size_t GetSigningPublicKeyLen () const;
Expand Down Expand Up @@ -141,7 +141,7 @@ namespace data
const uint8_t * GetPrivateKey () const { return m_PrivateKey; };
const uint8_t * GetSigningPrivateKey () const { return m_SigningPrivateKey; };
uint8_t * GetPadding();
void RecalculateIdentHash(uint8_t * buf=nullptr) { m_Public->RecalculateIdentHash(buf); }
void RecalculateIdentHash(uint8_t * buf=nullptr) { m_Public->RecalculateIdentHash(buf); }
void Sign (const uint8_t * buf, int len, uint8_t * signature) const;

size_t GetFullLen () const { return m_Public->GetFullLen () + 256 + m_Public->GetSigningPrivateKeyLen (); };
Expand Down
4 changes: 2 additions & 2 deletions libi2pd/LeaseSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ namespace data
}

bool LeaseSet::HasExpiredLeases () const
{
{
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
for (const auto& it: m_Leases)
if (ts >= it->endDate) return true;
return false;
}
}

bool LeaseSet::IsExpired () const
{
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/LeaseSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace data
struct LeaseCmp
{
bool operator() (std::shared_ptr<const Lease> l1, std::shared_ptr<const Lease> l2) const
{
{
if (l1->tunnelID != l2->tunnelID)
return l1->tunnelID < l2->tunnelID;
else
Expand Down
4 changes: 2 additions & 2 deletions libi2pd/NetDb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ namespace data
std::set<IdentHash> excluded;
excluded.insert (i2p::context.GetIdentHash ()); // don't flood to itself
excluded.insert (ident); // don't flood back
for (int i = 0; i < 3; i++)
for (int i = 0; i < 3; i++)
{
auto floodfill = GetClosestFloodfill (ident, excluded);
if (floodfill)
Expand Down Expand Up @@ -866,7 +866,7 @@ namespace data
if (closestFloodfills.empty ())
LogPrint (eLogWarning, "NetDb: Requested ", key, " not found, ", numExcluded, " peers excluded");
replyMsg = CreateDatabaseSearchReply (ident, closestFloodfills);
}
}
}
excluded += numExcluded * 32;
if (replyMsg)
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/RouterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ namespace data
supportedTransports |= (address->transportStyle == eTransportNTCP) ? eNTCPV4 : eSSUV4;
else
supportedTransports |= (address->transportStyle == eTransportNTCP) ? eNTCPV6 : eSSUV6;
}
}
}
else if (!strcmp (key, "port"))
address->port = boost::lexical_cast<int>(value);
Expand Down
4 changes: 2 additions & 2 deletions libi2pd/RouterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ namespace data
void DeleteBuffer () { delete[] m_Buffer; m_Buffer = nullptr; };
bool IsNewer (const uint8_t * buf, size_t len) const;

/** return true if we are in a router family and the signature is valid */
bool IsFamily(const std::string & fam) const;
/** return true if we are in a router family and the signature is valid */
bool IsFamily(const std::string & fam) const;

// implements RoutingDestination
std::shared_ptr<const IdentityEx> GetIdentity () const { return m_RouterIdentity; };
Expand Down
8 changes: 4 additions & 4 deletions libi2pd/SSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace transport
DeleteAllSessions ();
m_IsRunning = false;
m_TerminationTimer.cancel ();
m_TerminationTimerV6.cancel ();
m_TerminationTimerV6.cancel ();
m_Service.stop ();
m_Socket.close ();
m_ServiceV6.stop ();
Expand Down Expand Up @@ -357,7 +357,7 @@ namespace transport
{
if (!router) return nullptr;
auto address = router->GetSSUAddress (true); // v4 only
if (!address) return nullptr;
if (!address) return nullptr;
auto session = FindSession (boost::asio::ip::udp::endpoint (address->host, address->port));
if (session || !context.SupportsV6 ())
return session;
Expand Down Expand Up @@ -747,7 +747,7 @@ namespace transport
{
auto ts = i2p::util::GetSecondsSinceEpoch ();
for (auto& it: m_Sessions)
if (it.second->IsTerminationTimeoutExpired (ts))
if (it.second->IsTerminationTimeoutExpired (ts))
{
auto session = it.second;
m_Service.post ([session]
Expand All @@ -773,7 +773,7 @@ namespace transport
{
auto ts = i2p::util::GetSecondsSinceEpoch ();
for (auto& it: m_SessionsV6)
if (it.second->IsTerminationTimeoutExpired (ts))
if (it.second->IsTerminationTimeoutExpired (ts))
{
auto session = it.second;
m_ServiceV6.post ([session]
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/SSUData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace transport

void SSUData::UpdatePacketSize (const i2p::data::IdentHash& remoteIdent)
{
auto routerInfo = i2p::data::netdb.FindRouter (remoteIdent);
auto routerInfo = i2p::data::netdb.FindRouter (remoteIdent);
if (routerInfo)
AdjustPacketSize (routerInfo);
}
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/SSUData.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace transport
struct FragmentCmp
{
bool operator() (const std::unique_ptr<Fragment>& f1, const std::unique_ptr<Fragment>& f2) const
{
{
return f1->fragmentNum < f2->fragmentNum;
};
};
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Streaming.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace stream
struct PacketCmp
{
bool operator() (const Packet * p1, const Packet * p2) const
{
{
return p1->GetSeqn () < p2->GetSeqn ();
};
};
Expand Down
6 changes: 3 additions & 3 deletions libi2pd/Timestamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ namespace util
inline uint64_t GetMillisecondsSinceEpoch ()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()).count ();
std::chrono::system_clock::now().time_since_epoch()).count ();
}

inline uint32_t GetHoursSinceEpoch ()
{
return std::chrono::duration_cast<std::chrono::hours>(
std::chrono::system_clock::now().time_since_epoch()).count ();
std::chrono::system_clock::now().time_since_epoch()).count ();
}

inline uint64_t GetSecondsSinceEpoch ()
{
return std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch()).count ();
std::chrono::system_clock::now().time_since_epoch()).count ();
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions libi2pd/TransitTunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace tunnel
public:

TransitTunnel (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey);
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey);

virtual size_t GetNumTransmittedBytes () const { return 0; };

Expand All @@ -39,8 +39,8 @@ namespace tunnel
public:

TransitTunnelParticipant (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
TransitTunnel (receiveTunnelID, nextIdent, nextTunnelID,
layerKey, ivKey), m_NumTransmittedBytes (0) {};
~TransitTunnelParticipant ();
Expand All @@ -60,8 +60,8 @@ namespace tunnel
public:

TransitTunnelGateway (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
TransitTunnel (receiveTunnelID, nextIdent, nextTunnelID,
layerKey, ivKey), m_Gateway(this) {};

Expand All @@ -80,8 +80,8 @@ namespace tunnel
public:

TransitTunnelEndpoint (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
TransitTunnel (receiveTunnelID, nextIdent, nextTunnelID, layerKey, ivKey),
m_Endpoint (false) {}; // transit endpoint is always outbound

Expand All @@ -97,7 +97,7 @@ namespace tunnel

std::shared_ptr<TransitTunnel> CreateTransitTunnel (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey,
const uint8_t * layerKey,const uint8_t * ivKey,
bool isGateway, bool isEndpoint);
}
}
Expand Down
6 changes: 3 additions & 3 deletions libi2pd/Transports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace transport
m_Work (nullptr), m_PeerCleanupTimer (nullptr), m_PeerTestTimer (nullptr),
m_NTCPServer (nullptr), m_SSUServer (nullptr), m_DHKeysPairSupplier (5), // 5 pre-generated keys
m_TotalSentBytes(0), m_TotalReceivedBytes(0), m_TotalTransitTransmittedBytes (0),
m_InBandwidth (0), m_OutBandwidth (0), m_TransitBandwidth(0),
m_InBandwidth (0), m_OutBandwidth (0), m_TransitBandwidth(0),
m_LastInBandwidthUpdateBytes (0), m_LastOutBandwidthUpdateBytes (0),
m_LastTransitBandwidthUpdateBytes (0), m_LastBandwidthUpdateTime (0)
{
Expand All @@ -144,7 +144,7 @@ namespace transport
m_Service = new boost::asio::io_service ();
m_Work = new boost::asio::io_service::work (*m_Service);
m_PeerCleanupTimer = new boost::asio::deadline_timer (*m_Service);
m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service);
m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service);
}

i2p::config::GetOption("nat", m_IsNAT);
Expand Down Expand Up @@ -623,7 +623,7 @@ namespace transport
void Transports::DetectExternalIP ()
{
if (RoutesRestricted())
{
{
LogPrint(eLogInfo, "Transports: restricted routes enabled, not detecting ip");
i2p::context.SetStatus (eRouterStatusOK);
return;
Expand Down
4 changes: 2 additions & 2 deletions libi2pd/Transports.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ namespace transport

void NTCPResolve (const std::string& addr, const i2p::data::IdentHash& ident);
void HandleNTCPResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it,
i2p::data::IdentHash ident, std::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
i2p::data::IdentHash ident, std::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
void SSUResolve (const std::string& addr, const i2p::data::IdentHash& ident);
void HandleSSUResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it,
i2p::data::IdentHash ident, std::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
i2p::data::IdentHash ident, std::shared_ptr<boost::asio::ip::tcp::resolver> resolver);

void UpdateBandwidth ();
void DetectExternalIP ();
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/TunnelBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace tunnel
struct TunnelCreationTimeCmp
{
bool operator() (std::shared_ptr<const TunnelBase> t1, std::shared_ptr<const TunnelBase> t2) const
{
{
if (t1->GetCreationTime () != t2->GetCreationTime ())
return t1->GetCreationTime () > t2->GetCreationTime ();
else
Expand Down
Loading

0 comments on commit 50ba527

Please sign in to comment.