Browse Source

replaced boost::asio::io_service by boost::asio:io_context

pull/2094/merge
orignal 1 week ago
parent
commit
3474538697
  1. 2
      daemon/UPnP.h
  2. 4
      libi2pd/Destination.cpp
  3. 10
      libi2pd/Destination.h
  4. 2
      libi2pd/NTCP2.h
  5. 4
      libi2pd/Reseed.cpp
  6. 4
      libi2pd/SSU2.h
  7. 4
      libi2pd/Streaming.cpp
  8. 6
      libi2pd/Streaming.h
  9. 2
      libi2pd/Timestamp.cpp
  10. 2
      libi2pd/Timestamp.h
  11. 4
      libi2pd/Transports.cpp
  12. 6
      libi2pd/Transports.h
  13. 6
      libi2pd/util.h
  14. 4
      libi2pd_client/BOB.h
  15. 4
      libi2pd_client/ClientContext.cpp
  16. 4
      libi2pd_client/ClientContext.h
  17. 2
      libi2pd_client/I2CP.cpp
  18. 4
      libi2pd_client/I2CP.h
  19. 2
      libi2pd_client/I2PService.h
  20. 2
      libi2pd_client/SAM.h

2
daemon/UPnP.h

@ -67,7 +67,7 @@ namespace transport @@ -67,7 +67,7 @@ namespace transport
std::unique_ptr<std::thread> m_Thread;
std::condition_variable m_Started;
std::mutex m_StartedMutex;
boost::asio::io_service m_Service;
boost::asio::io_context m_Service;
boost::asio::deadline_timer m_Timer;
bool m_upnpUrlsInitialized = false;
struct UPNPUrls m_upnpUrls;

4
libi2pd/Destination.cpp

@ -23,7 +23,7 @@ namespace i2p @@ -23,7 +23,7 @@ namespace i2p
{
namespace client
{
LeaseSetDestination::LeaseSetDestination (boost::asio::io_service& service,
LeaseSetDestination::LeaseSetDestination (boost::asio::io_context& service,
bool isPublic, const std::map<std::string, std::string> * params):
m_Service (service), m_IsPublic (isPublic), m_PublishReplyToken (0),
m_LastSubmissionTime (0), m_PublishConfirmationTimer (m_Service),
@ -1000,7 +1000,7 @@ namespace client @@ -1000,7 +1000,7 @@ namespace client
return i2p::data::CRYPTO_KEY_TYPE_ELGAMAL;
}
ClientDestination::ClientDestination (boost::asio::io_service& service, const i2p::data::PrivateKeys& keys,
ClientDestination::ClientDestination (boost::asio::io_context& service, const i2p::data::PrivateKeys& keys,
bool isPublic, const std::map<std::string, std::string> * params):
LeaseSetDestination (service, isPublic, params),
m_Keys (keys), m_StreamingAckDelay (DEFAULT_INITIAL_ACK_DELAY),

10
libi2pd/Destination.h

@ -107,7 +107,7 @@ namespace client @@ -107,7 +107,7 @@ namespace client
// leaseSet = nullptr means not found
struct LeaseSetRequest
{
LeaseSetRequest (boost::asio::io_service& service): requestTime (0), requestTimeoutTimer (service) {};
LeaseSetRequest (boost::asio::io_context& service): requestTime (0), requestTimeoutTimer (service) {};
std::unordered_set<i2p::data::IdentHash> excluded;
uint64_t requestTime;
boost::asio::deadline_timer requestTimeoutTimer;
@ -125,10 +125,10 @@ namespace client @@ -125,10 +125,10 @@ namespace client
public:
LeaseSetDestination (boost::asio::io_service& service, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
LeaseSetDestination (boost::asio::io_context& service, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
~LeaseSetDestination ();
const std::string& GetNickname () const { return m_Nickname; };
boost::asio::io_service& GetService () { return m_Service; };
auto& GetService () { return m_Service; };
virtual void Start ();
virtual void Stop ();
@ -195,7 +195,7 @@ namespace client @@ -195,7 +195,7 @@ namespace client
private:
boost::asio::io_service& m_Service;
boost::asio::io_context& m_Service;
mutable std::mutex m_RemoteLeaseSetsMutex;
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
@ -241,7 +241,7 @@ namespace client @@ -241,7 +241,7 @@ namespace client
public:
ClientDestination (boost::asio::io_service& service, const i2p::data::PrivateKeys& keys,
ClientDestination (boost::asio::io_context& service, const i2p::data::PrivateKeys& keys,
bool isPublic, const std::map<std::string, std::string> * params = nullptr);
~ClientDestination ();

2
libi2pd/NTCP2.h

@ -253,7 +253,7 @@ namespace transport @@ -253,7 +253,7 @@ namespace transport
void Start ();
void Stop ();
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
std::mt19937& GetRng () { return m_Rng; };
bool AddNTCP2Session (std::shared_ptr<NTCP2Session> session, bool incoming = false);

4
libi2pd/Reseed.cpp

@ -552,7 +552,7 @@ namespace data @@ -552,7 +552,7 @@ namespace data
if (!url.port)
url.port = 443;
boost::asio::io_service service;
boost::asio::io_context service;
boost::system::error_code ecode;
boost::asio::ssl::context ctx(boost::asio::ssl::context::sslv23);
@ -746,7 +746,7 @@ namespace data @@ -746,7 +746,7 @@ namespace data
if (!url.port) url.port = 80;
boost::system::error_code ecode;
boost::asio::io_service service;
boost::asio::io_context service;
boost::asio::ip::tcp::socket s(service, boost::asio::ip::tcp::v6());
auto it = boost::asio::ip::tcp::resolver(service).resolve (

4
libi2pd/SSU2.h

@ -61,7 +61,7 @@ namespace transport @@ -61,7 +61,7 @@ namespace transport
public:
ReceiveService (const std::string& name): RunnableService (name) {};
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
void Start () { StartIOService (); };
void Stop () { StopIOService (); };
};
@ -73,7 +73,7 @@ namespace transport @@ -73,7 +73,7 @@ namespace transport
void Start ();
void Stop ();
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
void SetLocalAddress (const boost::asio::ip::address& localAddress);
bool SetProxy (const std::string& address, uint16_t port);
bool UsesProxy () const { return m_IsThroughProxy; };

4
libi2pd/Streaming.cpp

@ -66,7 +66,7 @@ namespace stream @@ -66,7 +66,7 @@ namespace stream
}
}
Stream::Stream (boost::asio::io_service& service, StreamingDestination& local,
Stream::Stream (boost::asio::io_context& service, StreamingDestination& local,
std::shared_ptr<const i2p::data::LeaseSet> remote, int port): m_Service (service),
m_SendStreamID (0), m_SequenceNumber (0), m_DropWindowDelaySequenceNumber (0),
m_TunnelsChangeSequenceNumber (0), m_LastReceivedSequenceNumber (-1), m_PreviousReceivedSequenceNumber (-1),
@ -95,7 +95,7 @@ namespace stream @@ -95,7 +95,7 @@ namespace stream
m_PacketACKInterval = (1000000LL*STREAMING_MTU)/inboundSpeed;
}
Stream::Stream (boost::asio::io_service& service, StreamingDestination& local):
Stream::Stream (boost::asio::io_context& service, StreamingDestination& local):
m_Service (service), m_SendStreamID (0), m_SequenceNumber (0), m_DropWindowDelaySequenceNumber (0),
m_TunnelsChangeSequenceNumber (0), m_LastReceivedSequenceNumber (-1), m_PreviousReceivedSequenceNumber (-1),
m_LastConfirmedReceivedSequenceNumber (0), // for limit inbound speed

6
libi2pd/Streaming.h

@ -175,9 +175,9 @@ namespace stream @@ -175,9 +175,9 @@ namespace stream
{
public:
Stream (boost::asio::io_service& service, StreamingDestination& local,
Stream (boost::asio::io_context& service, StreamingDestination& local,
std::shared_ptr<const i2p::data::LeaseSet> remote, int port = 0); // outgoing
Stream (boost::asio::io_service& service, StreamingDestination& local); // incoming
Stream (boost::asio::io_context& service, StreamingDestination& local); // incoming
~Stream ();
uint32_t GetSendStreamID () const { return m_SendStreamID; };
@ -255,7 +255,7 @@ namespace stream @@ -255,7 +255,7 @@ namespace stream
private:
boost::asio::io_service& m_Service;
boost::asio::io_context& m_Service;
uint32_t m_SendStreamID, m_RecvStreamID, m_SequenceNumber;
uint32_t m_DropWindowDelaySequenceNumber;
uint32_t m_TunnelsChangeSequenceNumber;

2
libi2pd/Timestamp.cpp

@ -60,7 +60,7 @@ namespace util @@ -60,7 +60,7 @@ namespace util
static void SyncTimeWithNTP (const std::string& address)
{
LogPrint (eLogInfo, "Timestamp: NTP request to ", address);
boost::asio::io_service service;
boost::asio::io_context service;
boost::system::error_code ec;
auto it = boost::asio::ip::udp::resolver (service).resolve (
boost::asio::ip::udp::resolver::query (address, "ntp"), ec);

2
libi2pd/Timestamp.h

@ -52,7 +52,7 @@ namespace util @@ -52,7 +52,7 @@ namespace util
bool m_IsRunning;
std::unique_ptr<std::thread> m_Thread;
boost::asio::io_service m_Service;
boost::asio::io_context m_Service;
boost::asio::deadline_timer m_Timer;
int m_SyncInterval;
std::vector<std::string> m_NTPServersList;

4
libi2pd/Transports.cpp

@ -174,8 +174,8 @@ namespace transport @@ -174,8 +174,8 @@ namespace transport
{
if (!m_Service)
{
m_Service = new boost::asio::io_service ();
m_Work = new boost::asio::io_service::work (*m_Service);
m_Service = new boost::asio::io_context ();
m_Work = new boost::asio::io_context::work (*m_Service);
m_PeerCleanupTimer = new boost::asio::deadline_timer (*m_Service);
m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service);
m_UpdateBandwidthTimer = new boost::asio::deadline_timer (*m_Service);

6
libi2pd/Transports.h

@ -139,7 +139,7 @@ namespace transport @@ -139,7 +139,7 @@ namespace transport
bool IsOnline() const { return m_IsOnline; };
void SetOnline (bool online);
boost::asio::io_service& GetService () { return *m_Service; };
auto& GetService () { return *m_Service; };
std::shared_ptr<i2p::crypto::X25519Keys> GetNextX25519KeysPair ();
void ReuseX25519KeysPair (std::shared_ptr<i2p::crypto::X25519Keys> pair);
@ -207,8 +207,8 @@ namespace transport @@ -207,8 +207,8 @@ namespace transport
volatile bool m_IsOnline;
bool m_IsRunning, m_IsNAT, m_CheckReserved;
std::thread * m_Thread;
boost::asio::io_service * m_Service;
boost::asio::io_service::work * m_Work;
boost::asio::io_context * m_Service;
boost::asio::io_context::work * m_Work;
boost::asio::deadline_timer * m_PeerCleanupTimer, * m_PeerTestTimer, * m_UpdateBandwidthTimer;
SSU2Server * m_SSU2Server;

6
libi2pd/util.h

@ -177,7 +177,7 @@ namespace util @@ -177,7 +177,7 @@ namespace util
RunnableService (const std::string& name): m_Name (name), m_IsRunning (false) {}
virtual ~RunnableService () {}
boost::asio::io_service& GetIOService () { return m_Service; }
auto& GetIOService () { return m_Service; }
bool IsRunning () const { return m_IsRunning; };
void StartIOService ();
@ -194,7 +194,7 @@ namespace util @@ -194,7 +194,7 @@ namespace util
std::string m_Name;
volatile bool m_IsRunning;
std::unique_ptr<std::thread> m_Thread;
boost::asio::io_service m_Service;
boost::asio::io_context m_Service;
};
class RunnableServiceWithWork: public RunnableService
@ -206,7 +206,7 @@ namespace util @@ -206,7 +206,7 @@ namespace util
private:
boost::asio::io_service::work m_Work;
boost::asio::io_context::work m_Work;
};
void SetThreadName (const char *name);

4
libi2pd_client/BOB.h

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2023, The PurpleI2P Project
* Copyright (c) 2013-2024, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
@ -254,7 +254,7 @@ namespace client @@ -254,7 +254,7 @@ namespace client
void Start ();
void Stop ();
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
void AddDestination (const std::string& name, std::shared_ptr<BOBDestination> dest);
void DeleteDestination (const std::string& name);
std::shared_ptr<BOBDestination> FindDestination (const std::string& name);

4
libi2pd_client/ClientContext.cpp

@ -345,7 +345,7 @@ namespace client @@ -345,7 +345,7 @@ namespace client
}
std::shared_ptr<ClientDestination> ClientContext::CreateNewLocalDestination (
boost::asio::io_service& service, bool isPublic,
boost::asio::io_context& service, bool isPublic,
i2p::data::SigningKeyType sigType, i2p::data::CryptoKeyType cryptoType,
const std::map<std::string, std::string> * params)
{
@ -399,7 +399,7 @@ namespace client @@ -399,7 +399,7 @@ namespace client
return localDestination;
}
std::shared_ptr<ClientDestination> ClientContext::CreateNewLocalDestination (boost::asio::io_service& service,
std::shared_ptr<ClientDestination> ClientContext::CreateNewLocalDestination (boost::asio::io_context& service,
const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params)
{
auto it = m_Destinations.find (keys.GetPublic ()->GetIdentHash ());

4
libi2pd_client/ClientContext.h

@ -79,13 +79,13 @@ namespace client @@ -79,13 +79,13 @@ namespace client
i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519,
i2p::data::CryptoKeyType cryptoType = i2p::data::CRYPTO_KEY_TYPE_ELGAMAL,
const std::map<std::string, std::string> * params = nullptr); // used by SAM only
std::shared_ptr<ClientDestination> CreateNewLocalDestination (boost::asio::io_service& service,
std::shared_ptr<ClientDestination> CreateNewLocalDestination (boost::asio::io_context& service,
bool isPublic = false, i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519,
i2p::data::CryptoKeyType cryptoType = i2p::data::CRYPTO_KEY_TYPE_ELGAMAL,
const std::map<std::string, std::string> * params = nullptr); // same as previous but on external io_service
std::shared_ptr<ClientDestination> CreateNewLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true,
const std::map<std::string, std::string> * params = nullptr);
std::shared_ptr<ClientDestination> CreateNewLocalDestination (boost::asio::io_service& service,
std::shared_ptr<ClientDestination> CreateNewLocalDestination (boost::asio::io_context& service,
const i2p::data::PrivateKeys& keys, bool isPublic = true,
const std::map<std::string, std::string> * params = nullptr); // same as previous but on external io_service
std::shared_ptr<ClientDestination> CreateNewMatchedTunnelDestination(const i2p::data::PrivateKeys &keys,

2
libi2pd_client/I2CP.cpp

@ -24,7 +24,7 @@ namespace i2p @@ -24,7 +24,7 @@ namespace i2p
namespace client
{
I2CPDestination::I2CPDestination (boost::asio::io_service& service, std::shared_ptr<I2CPSession> owner,
I2CPDestination::I2CPDestination (boost::asio::io_context& service, std::shared_ptr<I2CPSession> owner,
std::shared_ptr<const i2p::data::IdentityEx> identity, bool isPublic, bool isSameThread,
const std::map<std::string, std::string>& params):
LeaseSetDestination (service, isPublic, &params),

4
libi2pd_client/I2CP.h

@ -81,7 +81,7 @@ namespace client @@ -81,7 +81,7 @@ namespace client
{
public:
I2CPDestination (boost::asio::io_service& service, std::shared_ptr<I2CPSession> owner,
I2CPDestination (boost::asio::io_context& service, std::shared_ptr<I2CPSession> owner,
std::shared_ptr<const i2p::data::IdentityEx> identity, bool isPublic, bool isSameThread,
const std::map<std::string, std::string>& params);
~I2CPDestination () {};
@ -227,7 +227,7 @@ namespace client @@ -227,7 +227,7 @@ namespace client
void Start ();
void Stop ();
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
bool IsSingleThread () const { return m_IsSingleThread; };
bool InsertSession (std::shared_ptr<I2CPSession> session);

2
libi2pd_client/I2PService.h

@ -61,7 +61,7 @@ namespace client @@ -61,7 +61,7 @@ namespace client
}
void CreateStream (StreamRequestComplete streamRequestComplete, const std::string& dest, uint16_t port = 0);
void CreateStream(StreamRequestComplete complete, std::shared_ptr<const Address> address, uint16_t port);
inline boost::asio::io_service& GetService () { return m_LocalDestination->GetService (); }
auto& GetService () { return m_LocalDestination->GetService (); }
virtual void Start () = 0;
virtual void Stop () = 0;

2
libi2pd_client/SAM.h

@ -246,7 +246,7 @@ namespace client @@ -246,7 +246,7 @@ namespace client
void Start ();
void Stop ();
boost::asio::io_service& GetService () { return GetIOService (); };
auto& GetService () { return GetIOService (); };
std::shared_ptr<SAMSession> CreateSession (const std::string& id, SAMSessionType type, const std::string& destination, // empty string means transient
const std::map<std::string, std::string> * params);
bool AddSession (std::shared_ptr<SAMSession> session);

Loading…
Cancel
Save