From 50ba52756fee9bfc0c33a6c4979477865db2385c Mon Sep 17 00:00:00 2001 From: yangfl Date: Sat, 6 Jan 2018 12:01:44 +0800 Subject: [PATCH] fix mixing tabs and spaces --- daemon/HTTPServer.h | 2 +- daemon/I2PControl.cpp | 4 ++-- libi2pd/Base.cpp | 6 +++--- libi2pd/Crypto.cpp | 2 +- libi2pd/Datagram.h | 2 +- libi2pd/Destination.cpp | 2 +- libi2pd/Destination.h | 2 +- libi2pd/FS.cpp | 4 ++-- libi2pd/Garlic.cpp | 2 +- libi2pd/HTTP.cpp | 2 +- libi2pd/Identity.cpp | 2 +- libi2pd/Identity.h | 8 ++++---- libi2pd/LeaseSet.cpp | 4 ++-- libi2pd/LeaseSet.h | 2 +- libi2pd/NetDb.cpp | 4 ++-- libi2pd/RouterInfo.cpp | 2 +- libi2pd/RouterInfo.h | 4 ++-- libi2pd/SSU.cpp | 8 ++++---- libi2pd/SSUData.cpp | 2 +- libi2pd/SSUData.h | 2 +- libi2pd/Streaming.h | 2 +- libi2pd/Timestamp.h | 6 +++--- libi2pd/TransitTunnel.h | 18 +++++++++--------- libi2pd/Transports.cpp | 6 +++--- libi2pd/Transports.h | 4 ++-- libi2pd/TunnelBase.h | 2 +- libi2pd/TunnelEndpoint.cpp | 2 +- libi2pd/TunnelPool.cpp | 6 +++--- libi2pd_client/ClientContext.cpp | 18 +++++++++--------- libi2pd_client/I2CP.cpp | 16 ++++++++-------- libi2pd_client/I2PTunnel.cpp | 2 +- libi2pd_client/SAM.cpp | 6 +++--- 32 files changed, 77 insertions(+), 77 deletions(-) diff --git a/daemon/HTTPServer.h b/daemon/HTTPServer.h index 467522cf..f1ca10fc 100644 --- a/daemon/HTTPServer.h +++ b/daemon/HTTPServer.h @@ -63,7 +63,7 @@ namespace http private: void Run (); - void Accept (); + void Accept (); void HandleAccept(const boost::system::error_code& ecode, std::shared_ptr newSocket); void CreateConnection(std::shared_ptr newSocket); diff --git a/daemon/I2PControl.cpp b/daemon/I2PControl.cpp index be668183..494ea026 100644 --- a/daemon/I2PControl.cpp +++ b/daemon/I2PControl.cpp @@ -160,7 +160,7 @@ namespace client void I2PControlService::Handshake (std::shared_ptr 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 socket) @@ -187,7 +187,7 @@ namespace client } void I2PControlService::HandleRequestReceived (const boost::system::error_code& ecode, - size_t bytes_transferred, std::shared_ptr socket, + size_t bytes_transferred, std::shared_ptr socket, std::shared_ptr buf) { if (ecode) diff --git a/libi2pd/Base.cpp b/libi2pd/Base.cpp index bb7cda90..09f04c05 100644 --- a/libi2pd/Base.cpp +++ b/libi2pd/Base.cpp @@ -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; } } diff --git a/libi2pd/Crypto.cpp b/libi2pd/Crypto.cpp index fd0ef4bd..6109529d 100644 --- a/libi2pd/Crypto.cpp +++ b/libi2pd/Crypto.cpp @@ -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, diff --git a/libi2pd/Datagram.h b/libi2pd/Datagram.h index b72d3840..039417ea 100644 --- a/libi2pd/Datagram.h +++ b/libi2pd/Datagram.h @@ -106,7 +106,7 @@ namespace datagram DatagramDestination (std::shared_ptr 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; }; diff --git a/libi2pd/Destination.cpp b/libi2pd/Destination.cpp index 5742cbd4..33eff029 100644 --- a/libi2pd/Destination.cpp +++ b/libi2pd/Destination.cpp @@ -780,7 +780,7 @@ namespace client delete m_DatagramDestination; m_DatagramDestination = nullptr; } - return true; + return true; } else return false; diff --git a/libi2pd/Destination.h b/libi2pd/Destination.h index 2ca0b7a6..6f37e768 100644 --- a/libi2pd/Destination.h +++ b/libi2pd/Destination.h @@ -239,7 +239,7 @@ namespace client int m_StreamingAckDelay; std::shared_ptr m_StreamingDestination; // default std::map > 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; diff --git a/libi2pd/FS.cpp b/libi2pd/FS.cpp index 117f86d0..21fb103b 100644 --- a/libi2pd/FS.cpp +++ b/libi2pd/FS.cpp @@ -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 (); @@ -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; diff --git a/libi2pd/Garlic.cpp b/libi2pd/Garlic.cpp index b268baf2..59089072 100644 --- a/libi2pd/Garlic.cpp +++ b/libi2pd/Garlic.cpp @@ -125,7 +125,7 @@ namespace garlic m_LeaseSetUpdateMsgID = 0; } return !m_SessionTags.empty () || !m_UnconfirmedTagsMsgs.empty (); - } + } bool GarlicRoutingSession::CleanupUnconfirmedTags () { diff --git a/libi2pd/HTTP.cpp b/libi2pd/HTTP.cpp index 9ae88d4a..24e55457 100644 --- a/libi2pd/HTTP.cpp +++ b/libi2pd/HTTP.cpp @@ -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; } diff --git a/libi2pd/Identity.cpp b/libi2pd/Identity.cpp index d7679fd5..3fcd16ad 100644 --- a/libi2pd/Identity.cpp +++ b/libi2pd/Identity.cpp @@ -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); } diff --git a/libi2pd/Identity.h b/libi2pd/Identity.h index 21ad1e9b..584e6475 100644 --- a/libi2pd/Identity.h +++ b/libi2pd/Identity.h @@ -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 CreateEncryptor (const uint8_t * key) const; size_t GetFullLen () const { return m_ExtendedLen + DEFAULT_IDENTITY_SIZE; }; size_t GetSigningPublicKeyLen () const; @@ -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 (); }; diff --git a/libi2pd/LeaseSet.cpp b/libi2pd/LeaseSet.cpp index f715304e..d1a70ba5 100644 --- a/libi2pd/LeaseSet.cpp +++ b/libi2pd/LeaseSet.cpp @@ -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 { diff --git a/libi2pd/LeaseSet.h b/libi2pd/LeaseSet.h index 172a5078..c7d2066e 100644 --- a/libi2pd/LeaseSet.h +++ b/libi2pd/LeaseSet.h @@ -38,7 +38,7 @@ namespace data struct LeaseCmp { bool operator() (std::shared_ptr l1, std::shared_ptr l2) const - { + { if (l1->tunnelID != l2->tunnelID) return l1->tunnelID < l2->tunnelID; else diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 3fc7701e..0215c570 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -655,7 +655,7 @@ namespace data std::set 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) @@ -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) diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index b119fc26..e9c2a384 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -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(value); diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index 411c8095..09e2c015 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -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 GetIdentity () const { return m_RouterIdentity; }; diff --git a/libi2pd/SSU.cpp b/libi2pd/SSU.cpp index e7b62e48..2197552c 100644 --- a/libi2pd/SSU.cpp +++ b/libi2pd/SSU.cpp @@ -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 (); @@ -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; @@ -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] @@ -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] diff --git a/libi2pd/SSUData.cpp b/libi2pd/SSUData.cpp index dcc28325..d789e70e 100644 --- a/libi2pd/SSUData.cpp +++ b/libi2pd/SSUData.cpp @@ -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); } diff --git a/libi2pd/SSUData.h b/libi2pd/SSUData.h index 0ef31b10..fbd167bf 100644 --- a/libi2pd/SSUData.h +++ b/libi2pd/SSUData.h @@ -57,7 +57,7 @@ namespace transport struct FragmentCmp { bool operator() (const std::unique_ptr& f1, const std::unique_ptr& f2) const - { + { return f1->fragmentNum < f2->fragmentNum; }; }; diff --git a/libi2pd/Streaming.h b/libi2pd/Streaming.h index 887f21c2..202ff73f 100644 --- a/libi2pd/Streaming.h +++ b/libi2pd/Streaming.h @@ -98,7 +98,7 @@ namespace stream struct PacketCmp { bool operator() (const Packet * p1, const Packet * p2) const - { + { return p1->GetSeqn () < p2->GetSeqn (); }; }; diff --git a/libi2pd/Timestamp.h b/libi2pd/Timestamp.h index d48cb164..cddc6518 100644 --- a/libi2pd/Timestamp.h +++ b/libi2pd/Timestamp.h @@ -11,19 +11,19 @@ namespace util inline uint64_t GetMillisecondsSinceEpoch () { return std::chrono::duration_cast( - 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::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::system_clock::now().time_since_epoch()).count (); + std::chrono::system_clock::now().time_since_epoch()).count (); } } } diff --git a/libi2pd/TransitTunnel.h b/libi2pd/TransitTunnel.h index 4dbeb3b5..5b891dc3 100644 --- a/libi2pd/TransitTunnel.h +++ b/libi2pd/TransitTunnel.h @@ -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; }; @@ -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 (); @@ -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) {}; @@ -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 @@ -97,7 +97,7 @@ namespace tunnel std::shared_ptr 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); } } diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp index 982d0945..6dcbe56d 100644 --- a/libi2pd/Transports.cpp +++ b/libi2pd/Transports.cpp @@ -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) { @@ -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); @@ -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; diff --git a/libi2pd/Transports.h b/libi2pd/Transports.h index d60a6d23..d4410cb3 100644 --- a/libi2pd/Transports.h +++ b/libi2pd/Transports.h @@ -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 resolver); + i2p::data::IdentHash ident, std::shared_ptr 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 resolver); + i2p::data::IdentHash ident, std::shared_ptr resolver); void UpdateBandwidth (); void DetectExternalIP (); diff --git a/libi2pd/TunnelBase.h b/libi2pd/TunnelBase.h index b07adf53..8b7fb408 100644 --- a/libi2pd/TunnelBase.h +++ b/libi2pd/TunnelBase.h @@ -60,7 +60,7 @@ namespace tunnel struct TunnelCreationTimeCmp { bool operator() (std::shared_ptr t1, std::shared_ptr t2) const - { + { if (t1->GetCreationTime () != t2->GetCreationTime ()) return t1->GetCreationTime () > t2->GetCreationTime (); else diff --git a/libi2pd/TunnelEndpoint.cpp b/libi2pd/TunnelEndpoint.cpp index eb922360..324d5315 100644 --- a/libi2pd/TunnelEndpoint.cpp +++ b/libi2pd/TunnelEndpoint.cpp @@ -54,7 +54,7 @@ namespace tunnel { case eDeliveryTypeLocal: // 0 break; - case eDeliveryTypeTunnel: // 1 + case eDeliveryTypeTunnel: // 1 m.tunnelID = bufbe32toh (fragment); fragment += 4; // tunnelID m.hash = i2p::data::IdentHash (fragment); diff --git a/libi2pd/TunnelPool.cpp b/libi2pd/TunnelPool.cpp index a3592708..52736fa0 100644 --- a/libi2pd/TunnelPool.cpp +++ b/libi2pd/TunnelPool.cpp @@ -298,13 +298,13 @@ namespace tunnel } if (!failed) { - uint32_t msgID; + uint32_t msgID; RAND_bytes ((uint8_t *)&msgID, 4); { std::unique_lock l(m_TestsMutex); - m_Tests[msgID] = std::make_pair (*it1, *it2); + m_Tests[msgID] = std::make_pair (*it1, *it2); } - (*it1)->SendTunnelDataMsg ((*it2)->GetNextIdentHash (), (*it2)->GetNextTunnelID (), + (*it1)->SendTunnelDataMsg ((*it2)->GetNextIdentHash (), (*it2)->GetNextTunnelID (), CreateDeliveryStatusMsg (msgID)); ++it1; ++it2; } diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp index 5ad49ac5..41b8615a 100644 --- a/libi2pd_client/ClientContext.cpp +++ b/libi2pd_client/ClientContext.cpp @@ -108,7 +108,7 @@ namespace client try { m_SocksProxy = new i2p::proxy::SOCKSProxy("SOCKS", socksProxyAddr, socksProxyPort, - socksOutProxy, socksOutProxyAddr, socksOutProxyPort, localDestination); + socksOutProxy, socksOutProxyAddr, socksOutProxyPort, localDestination); m_SocksProxy->Start(); } catch (std::exception& e) @@ -158,7 +158,7 @@ namespace client try { m_I2CPServer = new I2CPServer (i2cpAddr, i2cpPort); - m_I2CPServer->Start (); + m_I2CPServer->Start (); } catch (std::exception& e) { @@ -235,7 +235,7 @@ namespace client LogPrint(eLogInfo, "Clients: stopping AddressBook"); m_AddressBook.Stop (); - { + { std::lock_guard lock(m_ForwardsMutex); m_ServerForwards.clear(); m_ClientForwards.clear(); @@ -350,7 +350,7 @@ namespace client } std::shared_ptr ClientContext::CreateNewLocalDestination (bool isPublic, - i2p::data::SigningKeyType sigType, i2p::data::CryptoKeyType cryptoType, + i2p::data::SigningKeyType sigType, i2p::data::CryptoKeyType cryptoType, const std::map * params) { i2p::data::PrivateKeys keys = i2p::data::PrivateKeys::CreateRandomKeys (sigType, cryptoType); @@ -653,11 +653,11 @@ namespace client I2PServerTunnel * serverTunnel; if (type == I2P_TUNNELS_SECTION_TYPE_HTTP) - serverTunnel = new I2PServerTunnelHTTP (name, host, port, localDestination, hostOverride, inPort, gzip); - else if (type == I2P_TUNNELS_SECTION_TYPE_IRC) - serverTunnel = new I2PServerTunnelIRC (name, host, port, localDestination, webircpass, inPort, gzip); + serverTunnel = new I2PServerTunnelHTTP (name, host, port, localDestination, hostOverride, inPort, gzip); + else if (type == I2P_TUNNELS_SECTION_TYPE_IRC) + serverTunnel = new I2PServerTunnelIRC (name, host, port, localDestination, webircpass, inPort, gzip); else // regular server tunnel by default - serverTunnel = new I2PServerTunnel (name, host, port, localDestination, inPort, gzip); + serverTunnel = new I2PServerTunnel (name, host, port, localDestination, inPort, gzip); LogPrint(eLogInfo, "Clients: Set Max Conns To ", maxConns); serverTunnel->SetMaxConnsPerMinute(maxConns); @@ -665,7 +665,7 @@ namespace client { LogPrint(eLogInfo, "Clients: disabling loopback address mapping"); serverTunnel->SetUniqueLocal(isUniqueLocal); - } + } if (accessList.length () > 0) { diff --git a/libi2pd_client/I2CP.cpp b/libi2pd_client/I2CP.cpp index 9c87cf0e..371456ee 100644 --- a/libi2pd_client/I2CP.cpp +++ b/libi2pd_client/I2CP.cpp @@ -280,7 +280,7 @@ namespace client buf[I2CP_HEADER_TYPE_OFFSET] = type; memcpy (buf + I2CP_HEADER_SIZE, payload, len); boost::asio::async_write (*socket, boost::asio::buffer (buf, l), boost::asio::transfer_all (), - std::bind(&I2CPSession::HandleI2CPMessageSent, shared_from_this (), + std::bind(&I2CPSession::HandleI2CPMessageSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, buf)); } else @@ -480,14 +480,14 @@ namespace client offset += 4; uint32_t nonce = bufbe32toh (buf + offset + payloadLen); if (m_IsSendAccepted) - SendMessageStatusMessage (nonce, eI2CPMessageStatusAccepted); // accepted + SendMessageStatusMessage (nonce, eI2CPMessageStatusAccepted); // accepted m_Destination->SendMsgTo (buf + offset, payloadLen, identity.GetIdentHash (), nonce); } - else - LogPrint(eLogError, "I2CP: cannot send message, too big"); - } - else - LogPrint(eLogError, "I2CP: invalid identity"); + else + LogPrint(eLogError, "I2CP: cannot send message, too big"); + } + else + LogPrint(eLogError, "I2CP: invalid identity"); } } else @@ -634,7 +634,7 @@ namespace client htobe32buf (buf + I2CP_HEADER_SIZE + 6, len); memcpy (buf + I2CP_HEADER_SIZE + 10, payload, len); boost::asio::async_write (*m_Socket, boost::asio::buffer (buf, l), boost::asio::transfer_all (), - std::bind(&I2CPSession::HandleI2CPMessageSent, shared_from_this (), + std::bind(&I2CPSession::HandleI2CPMessageSent, shared_from_this (), std::placeholders::_1, std::placeholders::_2, buf)); } diff --git a/libi2pd_client/I2PTunnel.cpp b/libi2pd_client/I2PTunnel.cpp index 8117a755..975cc4ce 100644 --- a/libi2pd_client/I2PTunnel.cpp +++ b/libi2pd_client/I2PTunnel.cpp @@ -93,7 +93,7 @@ namespace client MapToLoopback(m_Socket, ident); } #endif - m_Socket->async_connect (m_RemoteEndpoint, std::bind (&I2PTunnelConnection::HandleConnect, + m_Socket->async_connect (m_RemoteEndpoint, std::bind (&I2PTunnelConnection::HandleConnect, shared_from_this (), std::placeholders::_1)); } } diff --git a/libi2pd_client/SAM.cpp b/libi2pd_client/SAM.cpp index 13728eba..57767e77 100644 --- a/libi2pd_client/SAM.cpp +++ b/libi2pd_client/SAM.cpp @@ -664,7 +664,7 @@ namespace client if (len > 0) // still some data { boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, len), - std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); + std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); } else // no more data Terminate ("no more data"); @@ -681,7 +681,7 @@ namespace client { if (bytes_transferred > 0) boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, bytes_transferred), - std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); // postpone termination + std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); // postpone termination else { auto s = shared_from_this (); @@ -698,7 +698,7 @@ namespace client { if (m_SocketType != eSAMSocketTypeTerminated) // check for possible race condition with Terminate() boost::asio::async_write (m_Socket, boost::asio::buffer (m_StreamBuffer, bytes_transferred), - std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); + std::bind (&SAMSocket::HandleWriteI2PData, shared_from_this (), std::placeholders::_1)); } }